medical-form-printer 0.1.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.
@@ -0,0 +1,3188 @@
1
+ /**
2
+ * @fileoverview PrintSchema type definitions
3
+ * @module types/print-schema
4
+ * @description Defines complete type system for print layout configuration
5
+ * @modif 2024-04-07
6
+ */
7
+ /** Page size */
8
+ type PageSize = 'A4' | 'A5' | '16K';
9
+ /** Page orientation */
10
+ type PageOrientation = 'portrait' | 'landscape';
11
+ /** Section type */
12
+ type SectionType = 'info-grid' | 'table' | 'checkbox-grid' | 'signature-area' | 'notes' | 'free-text' | 'section-title' | 'medical-checkbox-row' | 'inline-row' | 'container';
13
+ /** Cell data type */
14
+ type CellType = 'text' | 'checkbox' | 'date' | 'number' | 'signature' | 'checkbox-inline' | 'compound' | 'textarea' | 'checkbox-text';
15
+ /** Header configuration */
16
+ interface PrintHeader {
17
+ /** Hospital name */
18
+ hospital: string;
19
+ /** Department name */
20
+ department?: string;
21
+ /** Form title */
22
+ title: string;
23
+ /** Whether to show logo */
24
+ showLogo?: boolean;
25
+ /** Logo URL */
26
+ logoUrl?: string;
27
+ }
28
+ /** Footer configuration */
29
+ interface PrintFooter {
30
+ /** Whether to show page number */
31
+ showPageNumber?: boolean;
32
+ /** Notes text */
33
+ notes?: string;
34
+ }
35
+ /** Info grid cell */
36
+ interface InfoGridCell {
37
+ /** Label text */
38
+ label: string;
39
+ /** Field name in formData */
40
+ field: string;
41
+ /** Cell span */
42
+ span?: number;
43
+ /** Data type */
44
+ type?: CellType;
45
+ /** Suffix (e.g., '℃', 'kg') */
46
+ suffix?: string;
47
+ /** Custom width */
48
+ width?: string;
49
+ /** checkbox-inline options (e.g., ['No', 'Yes']) */
50
+ inlineOptions?: string[];
51
+ /** compound template format (e.g., '{systolic}/{diastolic}mmHg') */
52
+ compoundFormat?: string;
53
+ /** compound field mapping (e.g., { systolic: 'bp_systolic', diastolic: 'bp_diastolic' }) */
54
+ compoundFields?: Record<string, string>;
55
+ /** textarea minimum height */
56
+ minHeight?: string;
57
+ /** checkbox-text checkbox field name */
58
+ checkboxField?: string;
59
+ /** checkbox-text text field name */
60
+ textField?: string;
61
+ /** checkbox-text display text */
62
+ text?: string;
63
+ }
64
+ /** Info grid row */
65
+ interface InfoGridRow {
66
+ cells: InfoGridCell[];
67
+ }
68
+ /** Info grid configuration */
69
+ interface InfoGridConfig {
70
+ /** Number of columns */
71
+ columns: number;
72
+ /** Row configuration */
73
+ rows: InfoGridRow[];
74
+ }
75
+ /** Table column configuration */
76
+ interface TableColumn {
77
+ /** Column header */
78
+ header: string;
79
+ /** Field name in formData */
80
+ field: string;
81
+ /** Column width */
82
+ width?: string;
83
+ /** Data type */
84
+ type?: CellType;
85
+ /** Options (for select type) */
86
+ options?: string[];
87
+ }
88
+ /** Table configuration */
89
+ interface TableConfig$1 {
90
+ /** Column configuration */
91
+ columns: TableColumn[];
92
+ /** Array field name in formData */
93
+ dataField: string;
94
+ /** Whether to show row numbers */
95
+ showRowNumber?: boolean;
96
+ }
97
+ /** Checkbox option */
98
+ interface CheckboxOption {
99
+ /** Option value */
100
+ value: string;
101
+ /** Display label */
102
+ label: string;
103
+ /** Whether has additional input */
104
+ hasInput?: boolean;
105
+ /** Additional input field name */
106
+ inputField?: string;
107
+ }
108
+ /** Checkbox item (items mode) */
109
+ interface CheckboxItem {
110
+ /** Item type: checkbox or text-input */
111
+ type?: 'checkbox' | 'text-input';
112
+ /** Option value (for checkbox type) */
113
+ value?: string;
114
+ /** Display label */
115
+ label: string;
116
+ /** Whether has additional input (for checkbox type) */
117
+ hasInput?: boolean;
118
+ /** Additional input field name */
119
+ inputField?: string;
120
+ }
121
+ /** Checkbox grid configuration */
122
+ interface CheckboxGridConfig {
123
+ /** Field name in formData */
124
+ field: string;
125
+ /** Option list (options mode) */
126
+ options?: CheckboxOption[];
127
+ /** Item list (items mode, supports more types) */
128
+ items?: CheckboxItem[];
129
+ /** Number of columns */
130
+ columns?: number;
131
+ /** Layout mode */
132
+ layout?: 'grid' | 'flex';
133
+ /** Prefix label */
134
+ prefixLabel?: string;
135
+ }
136
+ /** Signature field configuration */
137
+ interface SignatureField {
138
+ /** Label text */
139
+ label: string;
140
+ /** Field name in formData */
141
+ field: string;
142
+ /** Whether to show date */
143
+ showDate?: boolean;
144
+ }
145
+ /** Signature area configuration */
146
+ interface SignatureConfig {
147
+ fields: SignatureField[];
148
+ }
149
+ /** Notes configuration */
150
+ interface NotesConfig {
151
+ /** Static text content */
152
+ content: string;
153
+ /** Whether to show border */
154
+ showBorder?: boolean;
155
+ }
156
+ /** Free text configuration */
157
+ interface FreeTextConfig {
158
+ /** Field name in formData */
159
+ field: string;
160
+ /** Minimum height */
161
+ minHeight?: string;
162
+ }
163
+ /** Section title configuration */
164
+ interface SectionTitleConfig {
165
+ /** Title text */
166
+ text: string;
167
+ /** Alignment */
168
+ align?: 'left' | 'center' | 'right';
169
+ /** Font size */
170
+ fontSize?: string;
171
+ /** Whether bold */
172
+ bold?: boolean;
173
+ }
174
+ /** Medical checkbox option configuration */
175
+ interface MedicalCheckboxOption {
176
+ /** Option value */
177
+ value: string;
178
+ /** Display label */
179
+ label: string;
180
+ }
181
+ /** Extra input item configuration */
182
+ interface ExtraInput {
183
+ /** Input label */
184
+ label?: string;
185
+ /** Field name in formData */
186
+ field: string;
187
+ /** Suffix text */
188
+ suffix?: string;
189
+ }
190
+ /** Medical checkbox row configuration */
191
+ interface MedicalCheckboxRowConfig {
192
+ /** Prefix label (e.g., "Bowel movement:") */
193
+ prefixLabel?: string;
194
+ /** Field name in formData (for checkbox selection) */
195
+ field?: string;
196
+ /** Option list (□Yes/□No) */
197
+ options?: MedicalCheckboxOption[];
198
+ /** Input format template (e.g., "{input} times/day"), {input} will be replaced with input field */
199
+ inputFormat?: string;
200
+ /** Input field name (for inputFormat) */
201
+ inputField?: string;
202
+ /** Simple input label (e.g., "Disease name") */
203
+ inputLabel?: string;
204
+ /** Simple input field name (for inputLabel) */
205
+ inputLabelField?: string;
206
+ /** Extra input items list */
207
+ extraInputs?: ExtraInput[];
208
+ }
209
+ /** Inline row child element */
210
+ interface InlineRowChild {
211
+ /** Section type */
212
+ type: SectionType;
213
+ /** Section configuration */
214
+ config: SectionConfig;
215
+ }
216
+ /** Inline row configuration */
217
+ interface InlineRowConfig {
218
+ /** Child element list */
219
+ children: InlineRowChild[];
220
+ /** Column ratio configuration (e.g., [1, 2, 1] means 1:2:1) */
221
+ columns?: number[];
222
+ /** Gap */
223
+ gap?: string;
224
+ }
225
+ /** Container child element */
226
+ interface ContainerChild {
227
+ /** Section type */
228
+ type: SectionType;
229
+ /** Section configuration */
230
+ config: SectionConfig;
231
+ }
232
+ /** Container configuration */
233
+ interface ContainerConfig {
234
+ /** Child section list */
235
+ children: ContainerChild[];
236
+ /** Layout direction */
237
+ direction?: 'row' | 'column';
238
+ /** Border configuration */
239
+ border?: boolean | string;
240
+ /** Padding */
241
+ padding?: string;
242
+ /** Gap */
243
+ gap?: string;
244
+ }
245
+ /** Section configuration union type */
246
+ type SectionConfig = InfoGridConfig | TableConfig$1 | CheckboxGridConfig | SignatureConfig | NotesConfig | FreeTextConfig | SectionTitleConfig | MedicalCheckboxRowConfig | InlineRowConfig | ContainerConfig;
247
+ /** Print section */
248
+ interface PrintSection {
249
+ /** Section type */
250
+ type: SectionType;
251
+ /** Section title */
252
+ title?: string;
253
+ /** Section configuration */
254
+ config: SectionConfig;
255
+ }
256
+ /** Print layout configuration */
257
+ interface PrintSchema {
258
+ /** Page size */
259
+ pageSize: PageSize;
260
+ /** Page orientation */
261
+ orientation: PageOrientation;
262
+ /** Header configuration */
263
+ header: PrintHeader;
264
+ /** Section list */
265
+ sections: PrintSection[];
266
+ /** Footer configuration */
267
+ footer?: PrintFooter;
268
+ }
269
+ /** Form data type */
270
+ type FormData = Record<string, unknown>;
271
+
272
+ /**
273
+ * @fileoverview Theme type definitions
274
+ * @module types/theme
275
+ */
276
+ /** Font configuration */
277
+ interface FontConfig {
278
+ /** Body font */
279
+ body: string;
280
+ /** Heading font */
281
+ heading: string;
282
+ /** Monospace font */
283
+ mono: string;
284
+ }
285
+ /** Color configuration */
286
+ interface ColorConfig {
287
+ /** Primary color */
288
+ primary: string;
289
+ /** Border color */
290
+ border: string;
291
+ /** Background color */
292
+ background: string;
293
+ /** Label background color */
294
+ labelBackground: string;
295
+ /** Text color */
296
+ text: string;
297
+ /** Secondary text color */
298
+ textSecondary: string;
299
+ }
300
+ /** Spacing configuration */
301
+ interface SpacingConfig {
302
+ /** Page margin */
303
+ pageMargin: string;
304
+ /** Section gap */
305
+ sectionGap: string;
306
+ /** Cell padding */
307
+ cellPadding: string;
308
+ /** Header bottom margin */
309
+ headerMarginBottom: string;
310
+ /** Department name top margin */
311
+ departmentMarginTop: string;
312
+ /** Form title top margin */
313
+ titleMarginTop: string;
314
+ /** Signature area gap */
315
+ signatureGap: string;
316
+ /** Signature area top margin */
317
+ signatureMarginTop: string;
318
+ /** Signature line minimum width */
319
+ signatureLineWidth: string;
320
+ /** Free text minimum height */
321
+ freeTextMinHeight: string;
322
+ /** Footer top margin */
323
+ footerMarginTop: string;
324
+ /** Extra small spacing (2mm) */
325
+ xs: string;
326
+ /** Small spacing (3mm) */
327
+ sm: string;
328
+ }
329
+ /** Font size configuration */
330
+ interface FontSizeConfig {
331
+ /** Hospital name */
332
+ hospitalName: string;
333
+ /** Form title */
334
+ formTitle: string;
335
+ /** Section title */
336
+ sectionTitle: string;
337
+ /** Body text */
338
+ body: string;
339
+ /** Small text */
340
+ small: string;
341
+ }
342
+ /** Theme configuration */
343
+ interface Theme {
344
+ /** Fonts */
345
+ fonts: FontConfig;
346
+ /** Colors */
347
+ colors: ColorConfig;
348
+ /** Spacing */
349
+ spacing: SpacingConfig;
350
+ /** Font sizes */
351
+ fontSize: FontSizeConfig;
352
+ /** Border width */
353
+ borderWidth: string;
354
+ }
355
+ /**
356
+ * Size multipliers configuration (for base unit system)
357
+ * All values are multipliers relative to the base unit
358
+ */
359
+ interface SizeMultipliers {
360
+ /** Font size multipliers */
361
+ fontSize: {
362
+ /** Body font size multiplier */
363
+ body: number;
364
+ /** Small font size multiplier */
365
+ small: number;
366
+ /** Section title multiplier */
367
+ sectionTitle: number;
368
+ /** Hospital name multiplier */
369
+ hospitalName: number;
370
+ /** Form title multiplier */
371
+ formTitle: number;
372
+ };
373
+ /** Line height multiplier (relative to font size) */
374
+ lineHeight: number;
375
+ /** Spacing multipliers */
376
+ spacing: {
377
+ /** Page margin multiplier */
378
+ pageMargin: number;
379
+ /** Section gap multiplier */
380
+ sectionGap: number;
381
+ /** Cell horizontal padding multiplier */
382
+ cellPaddingX: number;
383
+ /** Cell vertical padding multiplier */
384
+ cellPaddingY: number;
385
+ /** Header bottom margin multiplier */
386
+ headerMarginBottom: number;
387
+ /** Department name top margin multiplier */
388
+ departmentMarginTop: number;
389
+ /** Form title top margin multiplier */
390
+ titleMarginTop: number;
391
+ /** Signature area gap multiplier */
392
+ signatureGap: number;
393
+ /** Signature area top margin multiplier */
394
+ signatureMarginTop: number;
395
+ /** Signature line minimum width multiplier */
396
+ signatureLineWidth: number;
397
+ /** Free text minimum height multiplier */
398
+ freeTextMinHeight: number;
399
+ /** Footer top margin multiplier */
400
+ footerMarginTop: number;
401
+ /** Extra small spacing multiplier */
402
+ xs: number;
403
+ /** Small spacing multiplier */
404
+ sm: number;
405
+ };
406
+ /** Border width multiplier */
407
+ borderWidth: number;
408
+ }
409
+ /**
410
+ * Scaled theme configuration
411
+ * Contains base unit and multiplier configuration for generating final Theme
412
+ */
413
+ interface ScaledThemeConfig {
414
+ /** Base unit value (millimeters) */
415
+ baseUnit: number;
416
+ /** Size multiplier configuration */
417
+ multipliers: SizeMultipliers;
418
+ /** Font configuration */
419
+ fonts: FontConfig;
420
+ /** Color configuration */
421
+ colors: ColorConfig;
422
+ }
423
+
424
+ /** Date format options */
425
+ interface DateFormatOptions {
426
+ /** Date format */
427
+ dateFormat?: string;
428
+ /** Time format */
429
+ timeFormat?: string;
430
+ /** DateTime format */
431
+ dateTimeFormat?: string;
432
+ }
433
+ /** Render options */
434
+ interface RenderOptions {
435
+ /** Theme configuration */
436
+ theme?: Partial<Theme>;
437
+ /** Locale */
438
+ locale?: string;
439
+ /** Date format options */
440
+ dateFormat?: DateFormatOptions;
441
+ /** Empty value placeholder */
442
+ emptyPlaceholder?: string;
443
+ /** Custom formatters */
444
+ formatters?: Record<string, (value: unknown) => string>;
445
+ /** CSS class name prefix (for isolation mode) */
446
+ classPrefix?: string;
447
+ }
448
+ /** PDF generation options */
449
+ interface PdfOptions extends RenderOptions {
450
+ /** Watermark text */
451
+ watermark?: string;
452
+ /** Watermark opacity (0-1) */
453
+ watermarkOpacity?: number;
454
+ /** Whether to generate PDF/A format */
455
+ pdfA?: boolean;
456
+ }
457
+ /** PDF merge options */
458
+ interface MergeOptions {
459
+ /** Whether to generate table of contents */
460
+ tableOfContents?: boolean;
461
+ /** Section divider titles */
462
+ sectionDividers?: boolean;
463
+ }
464
+ /** Merge document item */
465
+ interface MergeDocumentItem {
466
+ /** Print configuration */
467
+ schema: PrintSchema;
468
+ /** Form data */
469
+ data: FormData;
470
+ /** Document title (for table of contents) */
471
+ title?: string;
472
+ }
473
+
474
+ /**
475
+ * @fileoverview Watermark rendering utility functions
476
+ * @module utils/watermark
477
+ * @version 1.0.0
478
+ * @author Kiro
479
+ * @created 2026-01-03
480
+ *
481
+ * @description
482
+ * Provides unified watermark rendering functionality, ensuring all renderers use consistent watermark implementation.
483
+ * Supports opacity settings and boundary checking.
484
+ *
485
+ * @usedBy
486
+ * - ../renderer/isolated-html-renderer.ts - Isolated mode renderer
487
+ * - ../pagination/paginated-renderer.ts - Paginated renderer
488
+ * - ../renderer/templates/index.ts - Template renderer base class
489
+ */
490
+ /**
491
+ * Watermark configuration options
492
+ */
493
+ interface WatermarkOptions {
494
+ /** Watermark text */
495
+ text?: string;
496
+ /** Opacity (0-1), values outside range will be clamped */
497
+ opacity?: number;
498
+ /** CSS class name, defaults to 'watermark' */
499
+ className?: string;
500
+ }
501
+ /**
502
+ * Clamp a value within specified range
503
+ * @param value - Input value
504
+ * @param min - Minimum value
505
+ * @param max - Maximum value
506
+ * @returns Clamped value
507
+ */
508
+ declare function clamp(value: number, min: number, max: number): number;
509
+ /**
510
+ * Safely handle opacity value
511
+ * @param opacity - Original opacity value
512
+ * @returns Processed opacity value (0-1 range), undefined means no setting
513
+ */
514
+ declare function normalizeOpacity(opacity?: number): number | undefined;
515
+ /**
516
+ * Render watermark HTML
517
+ *
518
+ * @param options - Watermark configuration options
519
+ * @returns Watermark HTML string, returns empty string when no watermark
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * // Basic usage
524
+ * renderWatermarkHtml({ text: 'Internal Use Only' })
525
+ * // => '<div class="watermark">Internal Use Only</div>'
526
+ *
527
+ * // With opacity
528
+ * renderWatermarkHtml({ text: 'Draft', opacity: 0.5 })
529
+ * // => '<div class="watermark" style="opacity: 0.5">Draft</div>'
530
+ *
531
+ * // Custom class name (for namespacing)
532
+ * renderWatermarkHtml({ text: 'Draft', className: 'mpr-watermark' })
533
+ * // => '<div class="mpr-watermark">Draft</div>'
534
+ *
535
+ * // Opacity boundary handling
536
+ * renderWatermarkHtml({ text: 'Test', opacity: 1.5 })
537
+ * // => '<div class="watermark" style="opacity: 1">Test</div>'
538
+ * ```
539
+ */
540
+ declare function renderWatermarkHtml(options: WatermarkOptions): string;
541
+ /**
542
+ * Extract watermark configuration from render options
543
+ * Used for compatibility with existing RenderOptions interface
544
+ *
545
+ * @param options - Options object containing watermark configuration
546
+ * @returns Watermark configuration options
547
+ */
548
+ declare function extractWatermarkOptions(options?: {
549
+ watermark?: string;
550
+ watermarkOpacity?: number;
551
+ }, className?: string): WatermarkOptions;
552
+
553
+ /**
554
+ * @fileoverview Type-safe HTML builder
555
+ * @module utils/html-builder
556
+ * @description Provides chainable API for building HTML elements with unified HTML escaping
557
+ *
558
+ * @example
559
+ * // Basic usage
560
+ * const html = h('div').class('container').child('Hello').build()
561
+ * // => '<div class="container">Hello</div>'
562
+ *
563
+ * // Nested elements
564
+ * const html = h('table').child(
565
+ * h('tr').child(
566
+ * h('td').text('Cell 1'),
567
+ * h('td').text('Cell 2')
568
+ * )
569
+ * ).build()
570
+ */
571
+ /** HTML attribute value type */
572
+ type AttributeValue$1 = string | number | boolean | undefined | null;
573
+ /** Child element type */
574
+ type ChildElement$1 = string | HtmlBuilder | undefined | null | false;
575
+ /**
576
+ * Escape HTML special characters
577
+ * @param str - String to escape
578
+ * @returns Escaped string
579
+ */
580
+ declare function escapeHtml(str: string): string;
581
+ /**
582
+ * Escape HTML attribute value
583
+ * @param value - Attribute value
584
+ * @returns Escaped string
585
+ */
586
+ declare function escapeAttr(value: string): string;
587
+ /**
588
+ * HTML builder class
589
+ * Provides chainable API for building HTML elements
590
+ */
591
+ declare class HtmlBuilder {
592
+ private tagName;
593
+ private attributes;
594
+ private classNames;
595
+ private styles;
596
+ private children;
597
+ private rawContent;
598
+ constructor(tag: string);
599
+ /**
600
+ * Set attribute
601
+ * @param name - Attribute name
602
+ * @param value - Attribute value (undefined/null/false will skip the attribute)
603
+ */
604
+ attr(name: string, value: AttributeValue$1): this;
605
+ /**
606
+ * Set multiple attributes
607
+ * @param attrs - Attributes object
608
+ */
609
+ attrs(attrs: Record<string, AttributeValue$1>): this;
610
+ /**
611
+ * Add CSS class names
612
+ * @param names - Class names (supports multiple arguments or space-separated)
613
+ */
614
+ class(...names: (string | undefined | null | false)[]): this;
615
+ /**
616
+ * Set ID
617
+ * @param id - Element ID
618
+ */
619
+ id(id: string): this;
620
+ /**
621
+ * Set single style
622
+ * @param property - CSS property name
623
+ * @param value - CSS property value
624
+ */
625
+ style(property: string, value: string | undefined | null): this;
626
+ /**
627
+ * Set multiple styles
628
+ * @param styles - Styles object
629
+ */
630
+ css(styles: Record<string, string | undefined | null>): this;
631
+ /**
632
+ * Add child elements (auto-escapes text)
633
+ * @param children - Child elements
634
+ */
635
+ child(...children: ChildElement$1[]): this;
636
+ /**
637
+ * Add text content (auto-escaped)
638
+ * @param text - Text content
639
+ */
640
+ text(text: string | number | undefined | null): this;
641
+ /**
642
+ * Add raw HTML (not escaped)
643
+ * @param html - Raw HTML string
644
+ */
645
+ raw(html: string): this;
646
+ /**
647
+ * Conditional rendering
648
+ * @param condition - Condition
649
+ * @param builder - Builder function to execute when condition is true
650
+ */
651
+ when(condition: boolean, builder: (b: this) => void): this;
652
+ /**
653
+ * Build HTML string
654
+ * @returns HTML string
655
+ */
656
+ build(): string;
657
+ /**
658
+ * Convert to string (equivalent to build)
659
+ */
660
+ toString(): string;
661
+ }
662
+ /**
663
+ * Create HTML element builder
664
+ * @param tag - Tag name
665
+ * @returns HtmlBuilder instance
666
+ *
667
+ * @example
668
+ * h('div').class('container').text('Hello').build()
669
+ */
670
+ declare function h(tag: string): HtmlBuilder;
671
+ /**
672
+ * Create document fragment (container for multiple elements)
673
+ * @param children - Child elements
674
+ * @returns HTML string
675
+ */
676
+ declare function fragment(...children: ChildElement$1[]): string;
677
+ /**
678
+ * Conditional rendering
679
+ * @param condition - Condition
680
+ * @param content - Content when condition is true
681
+ * @param fallback - Content when condition is false (optional)
682
+ */
683
+ declare function when(condition: boolean, content: ChildElement$1 | (() => ChildElement$1), fallback?: ChildElement$1 | (() => ChildElement$1)): string;
684
+ /**
685
+ * List rendering
686
+ * @param items - Data array
687
+ * @param renderer - Render function
688
+ * @returns HTML string
689
+ */
690
+ declare function each<T>(items: T[] | undefined | null, renderer: (item: T, index: number) => ChildElement$1): string;
691
+
692
+ /**
693
+ * @fileoverview HTML Rendering Core
694
+ * @module renderer/html-renderer
695
+ */
696
+
697
+ /**
698
+ * Render PrintSchema and FormData to a complete HTML document
699
+ *
700
+ * This is the main rendering function that generates a complete HTML document
701
+ * with embedded CSS styles, ready for printing or PDF generation.
702
+ *
703
+ * @param schema - Print layout configuration defining page size, header, sections, and footer
704
+ * @param data - Form data object containing field values
705
+ * @param options - Optional render configuration
706
+ * @param options.theme - Custom theme configuration for fonts, colors, and spacing
707
+ * @param options.watermark - Watermark text to display on the page
708
+ * @param options.watermarkOpacity - Watermark opacity (0-1)
709
+ * @returns Complete HTML document string including DOCTYPE, head, and body
710
+ *
711
+ * @example
712
+ * ```typescript
713
+ * import { renderToHtml } from 'medical-form-printer'
714
+ *
715
+ * const html = renderToHtml(printSchema, formData, {
716
+ * watermark: 'Internal Use Only',
717
+ * watermarkOpacity: 0.1,
718
+ * theme: {
719
+ * colors: { primary: '#1a1a1a' }
720
+ * }
721
+ * })
722
+ *
723
+ * // Display in iframe or use for PDF generation
724
+ * document.getElementById('preview').innerHTML = html
725
+ * ```
726
+ */
727
+ declare function renderToHtml(schema: PrintSchema, data: FormData, options?: RenderOptions & {
728
+ watermark?: string;
729
+ watermarkOpacity?: number;
730
+ }): string;
731
+
732
+ /**
733
+ * @fileoverview Isolated Mode HTML Renderer
734
+ * @module renderer/isolated-html-renderer
735
+ * @version 1.1.0
736
+ * @author Kiro
737
+ * @created 2026-01-03
738
+ * @modified 2026-01-03
739
+ *
740
+ * @description
741
+ * Generates HTML output with CSS isolation, ensuring:
742
+ * 1. All class names have mpr- prefix
743
+ * 2. Styles are completely isolated from external influence
744
+ * 3. Font is forced to use Source Han Serif SC
745
+ *
746
+ * @dependencies
747
+ * - ../types/print-schema - Print configuration types
748
+ * - ../types/options - Render options types
749
+ * - ../styles - Style system
750
+ * - ./section-renderers - Section renderers
751
+ * - ../utils - Utility functions
752
+ *
753
+ * @usedBy
754
+ * - ../index.ts - Library main entry
755
+ */
756
+
757
+ /**
758
+ * Isolated render options
759
+ */
760
+ interface IsolatedRenderOptions extends RenderOptions {
761
+ /** Watermark text */
762
+ watermark?: string;
763
+ /** Watermark opacity (0-1), values outside range will be clamped */
764
+ watermarkOpacity?: number;
765
+ }
766
+ /**
767
+ * Render PrintSchema and FormData to isolated HTML string
768
+ *
769
+ * @param schema - Print layout configuration
770
+ * @param data - Form data
771
+ * @param options - Render options (font configuration will be ignored)
772
+ * @returns Complete isolated HTML document
773
+ *
774
+ * @description
775
+ * Generated HTML has the following characteristics:
776
+ * 1. All content wrapped in .mpr-root isolation container
777
+ * 2. CSS embedded in <style> tag within isolation container
778
+ * 3. All class names have mpr- prefix
779
+ * 4. Font forced to use embedded Source Han Serif SC
780
+ *
781
+ * @example
782
+ * ```typescript
783
+ * const html = renderToIsolatedHtml(schema, data)
784
+ * // Output HTML styles are completely isolated, safe to embed in any page
785
+ * ```
786
+ */
787
+ declare function renderToIsolatedHtml(schema: PrintSchema, data: FormData, options?: IsolatedRenderOptions): string;
788
+ /**
789
+ * Render isolated HTML fragment (without DOCTYPE and html/head/body tags)
790
+ * Suitable for embedding into existing pages
791
+ *
792
+ * @param schema - Print layout configuration
793
+ * @param data - Form data
794
+ * @param options - Render options
795
+ * @returns Isolated HTML fragment
796
+ */
797
+ declare function renderToIsolatedFragment(schema: PrintSchema, data: FormData, options?: IsolatedRenderOptions): string;
798
+
799
+ /**
800
+ * @fileoverview Section renderer registry
801
+ * @module renderer/section-renderers
802
+ * @modified 2024-04-06
803
+ */
804
+
805
+ /**
806
+ * Section renderer function type
807
+ *
808
+ * A function that takes section configuration, form data, and optional render options,
809
+ * and returns an HTML string representing the rendered section.
810
+ *
811
+ * @param config - The section configuration object
812
+ * @param data - The form data containing field values
813
+ * @param options - Optional render options (theme, locale, formatters, etc.)
814
+ * @returns HTML string for the rendered section
815
+ */
816
+ type SectionRenderer = (config: SectionConfig, data: FormData, options?: RenderOptions) => string;
817
+ /**
818
+ * Register a custom section renderer for a new section type
819
+ *
820
+ * @param type - The section type identifier (e.g., 'custom-chart', 'vital-signs')
821
+ * @param renderer - The renderer function that generates HTML for this section type
822
+ * @returns void
823
+ *
824
+ * @example
825
+ * ```typescript
826
+ * registerSectionRenderer('vital-signs-chart', (config, data, options) => {
827
+ * const values = data[config.dataField] || []
828
+ * return `<div class="vital-signs-chart">...</div>`
829
+ * })
830
+ * ```
831
+ */
832
+ declare function registerSectionRenderer(type: string, renderer: SectionRenderer): void;
833
+ /**
834
+ * Get a registered section renderer by type
835
+ *
836
+ * @param type - The section type identifier
837
+ * @returns The renderer function if found, undefined otherwise
838
+ *
839
+ * @example
840
+ * ```typescript
841
+ * const renderer = getSectionRenderer('info-grid')
842
+ * if (renderer) {
843
+ * const html = renderer(config, data, options)
844
+ * }
845
+ * ```
846
+ */
847
+ declare function getSectionRenderer(type: string): SectionRenderer | undefined;
848
+
849
+ /**
850
+ * @fileoverview Default Strategy Context
851
+ * @module renderer/strategies/default-context
852
+ */
853
+
854
+ /**
855
+ * Create default strategy context
856
+ * Contains render strategies for all built-in section types
857
+ * @returns Configured strategy context
858
+ */
859
+ declare function createDefaultStrategyContext(): StrategyContext;
860
+
861
+ /**
862
+ * @fileoverview Section render strategy module
863
+ * @module renderer/strategies
864
+ *
865
+ * @description
866
+ * Implements section rendering using Strategy pattern.
867
+ * Each section type has an independent strategy class, unified dispatch through StrategyContext.
868
+ */
869
+
870
+ /**
871
+ * Section render strategy interface
872
+ * All section renderers must implement this interface
873
+ */
874
+ interface SectionRenderStrategy {
875
+ /** Section type supported by this strategy */
876
+ readonly type: string;
877
+ /**
878
+ * Render section
879
+ * @param config - Section configuration
880
+ * @param data - Form data
881
+ * @param options - Render options
882
+ * @returns HTML string
883
+ */
884
+ render(config: SectionConfig, data: FormData, options?: RenderOptions): string;
885
+ }
886
+ /**
887
+ * Strategy context
888
+ * Manages all section render strategies, selects appropriate strategy based on section type
889
+ */
890
+ declare class StrategyContext {
891
+ private strategies;
892
+ /**
893
+ * Register render strategy
894
+ * @param strategy - Render strategy instance
895
+ */
896
+ register(strategy: SectionRenderStrategy): void;
897
+ /**
898
+ * Batch register render strategies
899
+ * @param strategies - Array of render strategy instances
900
+ */
901
+ registerAll(strategies: SectionRenderStrategy[]): void;
902
+ /**
903
+ * Get render strategy
904
+ * @param type - Section type
905
+ * @returns Render strategy instance, undefined if not found
906
+ */
907
+ getStrategy(type: string): SectionRenderStrategy | undefined;
908
+ /**
909
+ * Check if type is supported
910
+ * @param type - Section type
911
+ * @returns Whether supported
912
+ */
913
+ hasStrategy(type: string): boolean;
914
+ /**
915
+ * Render section
916
+ * @param type - Section type
917
+ * @param config - Section configuration
918
+ * @param data - Form data
919
+ * @param options - Render options
920
+ * @returns HTML string
921
+ */
922
+ render(type: string, config: SectionConfig, data: FormData, options?: RenderOptions): string;
923
+ /**
924
+ * Get all registered strategy types
925
+ * @returns Array of strategy types
926
+ */
927
+ getRegisteredTypes(): string[];
928
+ }
929
+
930
+ /**
931
+ * @fileoverview Section Renderer Factory
932
+ * @module renderer/factory/section-renderer-factory
933
+ *
934
+ * @description
935
+ * Uses Factory pattern to create section renderer instances.
936
+ * Supports registering custom renderers for decoupling and extensibility.
937
+ */
938
+
939
+ /** Renderer creator function type */
940
+ type RendererCreator = () => SectionRenderStrategy;
941
+ /**
942
+ * Section Renderer Factory
943
+ * Responsible for creating and managing section renderer instances
944
+ */
945
+ declare class SectionRendererFactory {
946
+ private creators;
947
+ private instances;
948
+ private useCache;
949
+ /**
950
+ * Create factory instance
951
+ * @param useCache - Whether to cache renderer instances (default true)
952
+ */
953
+ constructor(useCache?: boolean);
954
+ /**
955
+ * Register built-in renderers
956
+ */
957
+ private registerBuiltInRenderers;
958
+ /**
959
+ * Register renderer creator function
960
+ * @param type - Section type
961
+ * @param creator - Creator function
962
+ */
963
+ register(type: string, creator: RendererCreator): void;
964
+ /**
965
+ * Register custom renderer instance
966
+ * @param renderer - Renderer instance
967
+ */
968
+ registerInstance(renderer: SectionRenderStrategy): void;
969
+ /**
970
+ * Create renderer instance
971
+ * @param type - Section type
972
+ * @returns Renderer instance, or undefined if type doesn't exist
973
+ */
974
+ create(type: string): SectionRenderStrategy | undefined;
975
+ /**
976
+ * Check if specified type is supported
977
+ * @param type - Section type
978
+ * @returns Whether supported
979
+ */
980
+ hasRenderer(type: string): boolean;
981
+ /**
982
+ * Get all registered types
983
+ * @returns Type array
984
+ */
985
+ getRegisteredTypes(): string[];
986
+ /**
987
+ * Render section
988
+ * @param type - Section type
989
+ * @param config - Section configuration
990
+ * @param data - Form data
991
+ * @param options - Render options
992
+ * @returns HTML string
993
+ */
994
+ render(type: string, config: SectionConfig, data: FormData, options?: RenderOptions): string;
995
+ /**
996
+ * Clear cached instances
997
+ */
998
+ clearCache(): void;
999
+ }
1000
+ /**
1001
+ * Get default factory instance (singleton)
1002
+ * @returns Default factory instance
1003
+ */
1004
+ declare function getDefaultSectionRendererFactory(): SectionRendererFactory;
1005
+
1006
+ /**
1007
+ * @fileoverview Formatter Factory
1008
+ * @module renderer/factory/formatter-factory
1009
+ *
1010
+ * @description
1011
+ * Uses Factory pattern to create data formatter instances.
1012
+ * Supports registering custom formatters for decoupling and extensibility.
1013
+ */
1014
+ /** Formatter function type */
1015
+ type Formatter<T = unknown> = (value: T, options?: Record<string, unknown>) => string;
1016
+ /** Formatter configuration */
1017
+ interface FormatterConfig {
1018
+ /** Date format */
1019
+ dateFormat?: string;
1020
+ /** Empty value placeholder */
1021
+ emptyPlaceholder?: string;
1022
+ /** Number precision */
1023
+ numberPrecision?: number;
1024
+ /** Boolean true value display */
1025
+ booleanTrueSymbol?: string;
1026
+ /** Boolean false value display */
1027
+ booleanFalseSymbol?: string;
1028
+ }
1029
+ /**
1030
+ * Formatter Factory
1031
+ * Responsible for creating and managing data formatters
1032
+ */
1033
+ declare class FormatterFactory {
1034
+ private formatters;
1035
+ private config;
1036
+ /**
1037
+ * Create factory instance
1038
+ * @param config - Formatter configuration
1039
+ */
1040
+ constructor(config?: FormatterConfig);
1041
+ /**
1042
+ * Register built-in formatters
1043
+ */
1044
+ private registerBuiltInFormatters;
1045
+ /**
1046
+ * Register formatter
1047
+ * @param type - Formatter type
1048
+ * @param formatter - Formatter function
1049
+ */
1050
+ register(type: string, formatter: Formatter): void;
1051
+ /**
1052
+ * Get formatter
1053
+ * @param type - Formatter type
1054
+ * @returns Formatter function, or undefined if not found
1055
+ */
1056
+ get(type: string): Formatter | undefined;
1057
+ /**
1058
+ * Check if formatter of specified type exists
1059
+ * @param type - Formatter type
1060
+ * @returns Whether exists
1061
+ */
1062
+ has(type: string): boolean;
1063
+ /**
1064
+ * Format value
1065
+ * @param value - Value to format
1066
+ * @param type - Formatter type
1067
+ * @returns Formatted string
1068
+ */
1069
+ format(value: unknown, type?: string): string;
1070
+ /**
1071
+ * Get all registered formatter types
1072
+ * @returns Type array
1073
+ */
1074
+ getRegisteredTypes(): string[];
1075
+ /**
1076
+ * Update configuration
1077
+ * @param config - New configuration
1078
+ */
1079
+ updateConfig(config: Partial<FormatterConfig>): void;
1080
+ /**
1081
+ * Get current configuration
1082
+ * @returns Current configuration
1083
+ */
1084
+ getConfig(): FormatterConfig;
1085
+ }
1086
+ /**
1087
+ * Get default factory instance (singleton)
1088
+ * @returns Default factory instance
1089
+ */
1090
+ declare function getDefaultFormatterFactory(): FormatterFactory;
1091
+
1092
+ /**
1093
+ * @fileoverview HTML Element Builder
1094
+ * @module renderer/builders/html-element-builder
1095
+ *
1096
+ * @description
1097
+ * Uses Builder pattern to chain-build HTML elements.
1098
+ * Supports fluent API: builder.tag('div').class('foo').child(...).build()
1099
+ */
1100
+ /** Attribute value type */
1101
+ type AttributeValue = string | number | boolean | undefined | null;
1102
+ /** Child element type */
1103
+ type ChildElement = string | HtmlElementBuilder | undefined | null | false;
1104
+ /**
1105
+ * HTML Element Builder
1106
+ * Provides fluent API for building HTML elements
1107
+ */
1108
+ declare class HtmlElementBuilder {
1109
+ private tagName;
1110
+ private attributes;
1111
+ private classNames;
1112
+ private styles;
1113
+ private children;
1114
+ private rawContent;
1115
+ /**
1116
+ * Create builder instance
1117
+ * @param tag - Tag name
1118
+ */
1119
+ constructor(tag: string);
1120
+ /**
1121
+ * Create new builder instance
1122
+ * @param tag - Tag name
1123
+ * @returns New builder instance
1124
+ */
1125
+ static tag(tag: string): HtmlElementBuilder;
1126
+ /**
1127
+ * Set attribute
1128
+ * @param name - Attribute name
1129
+ * @param value - Attribute value
1130
+ */
1131
+ attr(name: string, value: AttributeValue): this;
1132
+ /**
1133
+ * Set multiple attributes
1134
+ * @param attrs - Attributes object
1135
+ */
1136
+ attrs(attrs: Record<string, AttributeValue>): this;
1137
+ /**
1138
+ * Add CSS class names
1139
+ * @param names - Class names
1140
+ */
1141
+ class(...names: (string | undefined | null | false)[]): this;
1142
+ /**
1143
+ * Set ID
1144
+ * @param id - Element ID
1145
+ */
1146
+ id(id: string): this;
1147
+ /**
1148
+ * Set single style
1149
+ * @param property - CSS property name
1150
+ * @param value - CSS property value
1151
+ */
1152
+ style(property: string, value: string | undefined | null): this;
1153
+ /**
1154
+ * Set multiple styles
1155
+ * @param styles - Styles object
1156
+ */
1157
+ css(styles: Record<string, string | undefined | null>): this;
1158
+ /**
1159
+ * Add child elements
1160
+ * @param children - Child elements
1161
+ */
1162
+ child(...children: ChildElement[]): this;
1163
+ /**
1164
+ * Add text content (auto-escaped)
1165
+ * @param text - Text content
1166
+ */
1167
+ text(text: string | number | undefined | null): this;
1168
+ /**
1169
+ * Add raw HTML (not escaped)
1170
+ * @param html - Raw HTML string
1171
+ */
1172
+ raw(html: string): this;
1173
+ /**
1174
+ * Conditional rendering
1175
+ * @param condition - Condition
1176
+ * @param builder - Builder function to execute when condition is true
1177
+ */
1178
+ when(condition: boolean, builder: (b: this) => void): this;
1179
+ /**
1180
+ * Build HTML string
1181
+ * @returns HTML string
1182
+ */
1183
+ build(): string;
1184
+ /**
1185
+ * Convert to string
1186
+ */
1187
+ toString(): string;
1188
+ }
1189
+ declare const div: () => HtmlElementBuilder;
1190
+ declare const span: () => HtmlElementBuilder;
1191
+ declare const table: () => HtmlElementBuilder;
1192
+ declare const thead: () => HtmlElementBuilder;
1193
+ declare const tbody: () => HtmlElementBuilder;
1194
+ declare const tr: () => HtmlElementBuilder;
1195
+ declare const th: () => HtmlElementBuilder;
1196
+ declare const td: () => HtmlElementBuilder;
1197
+ declare const p: () => HtmlElementBuilder;
1198
+ declare const header: () => HtmlElementBuilder;
1199
+ declare const footer: () => HtmlElementBuilder;
1200
+ declare const main: () => HtmlElementBuilder;
1201
+ declare const h1: () => HtmlElementBuilder;
1202
+
1203
+ /**
1204
+ * @fileoverview Page Builder
1205
+ * @module renderer/builders/page-builder
1206
+ *
1207
+ * @description
1208
+ * Uses Builder pattern to construct complete print page structure.
1209
+ * Supports header, content, footer, watermark and other components.
1210
+ */
1211
+ /** Page configuration */
1212
+ interface PageConfig {
1213
+ /** Page size */
1214
+ pageSize: string;
1215
+ /** Page orientation */
1216
+ orientation: string;
1217
+ /** Language */
1218
+ lang?: string;
1219
+ }
1220
+ /** Header configuration */
1221
+ interface HeaderConfig {
1222
+ /** Hospital name */
1223
+ hospital: string;
1224
+ /** Department name */
1225
+ department?: string;
1226
+ /** Form title */
1227
+ title: string;
1228
+ /** Whether to show logo */
1229
+ showLogo?: boolean;
1230
+ /** Logo URL */
1231
+ logoUrl?: string;
1232
+ }
1233
+ /** Footer configuration */
1234
+ interface FooterConfig {
1235
+ /** Notes */
1236
+ notes?: string;
1237
+ /** Whether to show page number */
1238
+ showPageNumber?: boolean;
1239
+ /** Page number format */
1240
+ pageNumberFormat?: string;
1241
+ }
1242
+ /**
1243
+ * Page Builder
1244
+ * Constructs complete print page structure
1245
+ */
1246
+ declare class PageBuilder {
1247
+ private config;
1248
+ private css;
1249
+ private headerConfig;
1250
+ private footerConfig;
1251
+ private sections;
1252
+ private watermarkText;
1253
+ private watermarkOpacity;
1254
+ /**
1255
+ * Create page builder
1256
+ * @param config - Page configuration
1257
+ */
1258
+ constructor(config: PageConfig);
1259
+ /**
1260
+ * Set CSS styles
1261
+ * @param css - CSS string
1262
+ */
1263
+ setCSS(css: string): this;
1264
+ /**
1265
+ * Set header
1266
+ * @param config - Header configuration
1267
+ */
1268
+ setHeader(config: HeaderConfig): this;
1269
+ /**
1270
+ * Set footer
1271
+ * @param config - Footer configuration
1272
+ */
1273
+ setFooter(config: FooterConfig | null): this;
1274
+ /**
1275
+ * Add section content
1276
+ * @param html - Section HTML
1277
+ */
1278
+ addSection(html: string): this;
1279
+ /**
1280
+ * Add multiple section contents
1281
+ * @param htmls - Section HTML array
1282
+ */
1283
+ addSections(htmls: string[]): this;
1284
+ /**
1285
+ * Set watermark
1286
+ * @param text - Watermark text
1287
+ * @param opacity - Opacity
1288
+ */
1289
+ setWatermark(text: string, opacity?: number): this;
1290
+ /**
1291
+ * Build header HTML
1292
+ */
1293
+ private buildHeader;
1294
+ /**
1295
+ * Build footer HTML
1296
+ */
1297
+ private buildFooter;
1298
+ /**
1299
+ * Build watermark HTML
1300
+ */
1301
+ private buildWatermark;
1302
+ /**
1303
+ * Build page class names
1304
+ */
1305
+ private buildPageClasses;
1306
+ /**
1307
+ * Build complete page HTML
1308
+ * @returns Complete HTML document string
1309
+ */
1310
+ build(): string;
1311
+ }
1312
+
1313
+ /**
1314
+ * @fileoverview Table Builder
1315
+ * @module renderer/builders/table-builder
1316
+ *
1317
+ * @description
1318
+ * Uses Builder pattern to construct HTML table structure.
1319
+ * Supports header, body, row numbers, column widths and other configurations.
1320
+ */
1321
+ /** Column configuration */
1322
+ interface ColumnConfig {
1323
+ /** Column header */
1324
+ header: string;
1325
+ /** Data field */
1326
+ field: string;
1327
+ /** Column width */
1328
+ width?: string;
1329
+ /** Alignment */
1330
+ align?: 'left' | 'center' | 'right';
1331
+ /** Formatter function */
1332
+ formatter?: (value: unknown, row: Record<string, unknown>, index: number) => string;
1333
+ }
1334
+ /** Table configuration */
1335
+ interface TableConfig {
1336
+ /** Whether to show row numbers */
1337
+ showRowNumber?: boolean;
1338
+ /** Row number column header */
1339
+ rowNumberHeader?: string;
1340
+ /** Table class name */
1341
+ className?: string;
1342
+ /** Whether to show borders */
1343
+ bordered?: boolean;
1344
+ }
1345
+ /**
1346
+ * Table Builder
1347
+ * Constructs HTML table structure
1348
+ */
1349
+ declare class TableBuilder {
1350
+ private columns;
1351
+ private rows;
1352
+ private config;
1353
+ private headerRows;
1354
+ private footerRows;
1355
+ /**
1356
+ * Create table builder
1357
+ * @param config - Table configuration
1358
+ */
1359
+ constructor(config?: TableConfig);
1360
+ /**
1361
+ * Set configuration
1362
+ * @param config - Table configuration
1363
+ */
1364
+ setConfig(config: TableConfig): this;
1365
+ /**
1366
+ * Add column
1367
+ * @param column - Column configuration
1368
+ */
1369
+ addColumn(column: ColumnConfig): this;
1370
+ /**
1371
+ * Add multiple columns
1372
+ * @param columns - Column configuration array
1373
+ */
1374
+ addColumns(columns: ColumnConfig[]): this;
1375
+ /**
1376
+ * Set data rows
1377
+ * @param rows - Data row array
1378
+ */
1379
+ setRows(rows: Record<string, unknown>[]): this;
1380
+ /**
1381
+ * Add data row
1382
+ * @param row - Data row
1383
+ */
1384
+ addRow(row: Record<string, unknown>): this;
1385
+ /**
1386
+ * Add custom header row
1387
+ * @param cells - Cell content array
1388
+ */
1389
+ addHeaderRow(cells: string[]): this;
1390
+ /**
1391
+ * Add custom footer row
1392
+ * @param cells - Cell content array
1393
+ */
1394
+ addFooterRow(cells: string[]): this;
1395
+ /**
1396
+ * Build header HTML
1397
+ */
1398
+ private buildHeader;
1399
+ /**
1400
+ * Build body HTML
1401
+ */
1402
+ private buildBody;
1403
+ /**
1404
+ * Build footer HTML
1405
+ */
1406
+ private buildFooter;
1407
+ /**
1408
+ * Build table HTML
1409
+ * @returns Table HTML string
1410
+ */
1411
+ build(): string;
1412
+ /**
1413
+ * Build table element only (without wrapper div)
1414
+ * @returns Table HTML string
1415
+ */
1416
+ buildTable(): string;
1417
+ }
1418
+
1419
+ /**
1420
+ * @fileoverview Composite pattern - Section nesting
1421
+ * @module renderer/composite
1422
+ *
1423
+ * @description
1424
+ * Uses Composite pattern to uniformly handle single sections and nested sections.
1425
+ * SectionComponent interface defines unified render method,
1426
+ * LeafSection handles leaf nodes, ContainerSection handles container nodes.
1427
+ */
1428
+
1429
+ /**
1430
+ * Section component interface (Composite pattern's Component)
1431
+ * Defines unified render method, both leaf and container nodes implement this interface
1432
+ */
1433
+ interface SectionComponent {
1434
+ /** Render component */
1435
+ render(data: FormData, options?: RenderOptions): string;
1436
+ /** Get component type */
1437
+ getType(): SectionType;
1438
+ /** Whether this is a container node */
1439
+ isContainer(): boolean;
1440
+ }
1441
+ /**
1442
+ * Leaf section (Composite pattern's Leaf)
1443
+ * Handles section types without child nodes: info-grid, table, checkbox-grid, etc.
1444
+ */
1445
+ declare class LeafSection implements SectionComponent {
1446
+ private type;
1447
+ private config;
1448
+ constructor(type: SectionType, config: SectionConfig);
1449
+ render(data: FormData, options?: RenderOptions): string;
1450
+ getType(): SectionType;
1451
+ isContainer(): boolean;
1452
+ getConfig(): SectionConfig;
1453
+ }
1454
+ /**
1455
+ * Container section (Composite pattern's Composite)
1456
+ * Handles section types with child nodes: container, inline-row
1457
+ */
1458
+ declare class ContainerSection implements SectionComponent {
1459
+ private type;
1460
+ private config;
1461
+ private children;
1462
+ constructor(type: SectionType, config: ContainerConfig | InlineRowConfig);
1463
+ render(data: FormData, options?: RenderOptions): string;
1464
+ getType(): SectionType;
1465
+ isContainer(): boolean;
1466
+ getConfig(): ContainerConfig | InlineRowConfig;
1467
+ getChildren(): SectionComponent[];
1468
+ addChild(child: SectionComponent): void;
1469
+ removeChild(child: SectionComponent): void;
1470
+ /**
1471
+ * Recursively render all child nodes
1472
+ * @param data - Form data
1473
+ * @param options - Render options
1474
+ * @returns Array of child node HTML strings
1475
+ */
1476
+ renderChildren(data: FormData, options?: RenderOptions): string[];
1477
+ }
1478
+ /**
1479
+ * Create section component from PrintSection
1480
+ * @param section - Print section configuration
1481
+ * @returns Section component instance
1482
+ */
1483
+ declare function createSectionComponent(section: PrintSection): SectionComponent;
1484
+ /**
1485
+ * Section tree traverser
1486
+ * Provides depth-first traversal capability for section tree
1487
+ */
1488
+ declare class SectionTreeTraverser {
1489
+ /**
1490
+ * Depth-first traversal
1491
+ * @param root - Root component
1492
+ * @param visitor - Visitor function
1493
+ */
1494
+ traverse(root: SectionComponent, visitor: (component: SectionComponent, depth: number) => void): void;
1495
+ private traverseInternal;
1496
+ /**
1497
+ * Collect all leaf nodes
1498
+ * @param root - Root component
1499
+ * @returns Array of leaf nodes
1500
+ */
1501
+ collectLeaves(root: SectionComponent): LeafSection[];
1502
+ /**
1503
+ * Calculate tree depth
1504
+ * @param root - Root component
1505
+ * @returns Maximum depth of tree
1506
+ */
1507
+ getDepth(root: SectionComponent): number;
1508
+ }
1509
+ /**
1510
+ * Create section component tree from PrintSection array
1511
+ * @param sections - Print section configuration array
1512
+ * @returns Section component array
1513
+ */
1514
+ declare function createSectionTree(sections: PrintSection[]): SectionComponent[];
1515
+ /**
1516
+ * Render section component tree
1517
+ * @param components - Section component array
1518
+ * @param data - Form data
1519
+ * @param options - Render options
1520
+ * @returns HTML string
1521
+ */
1522
+ declare function renderSectionTree(components: SectionComponent[], data: FormData, options?: RenderOptions): string;
1523
+
1524
+ /**
1525
+ * @fileoverview Template Method Pattern - Page Rendering Flow
1526
+ * @module renderer/templates
1527
+ * @version 1.2.0
1528
+ * @author Kiro
1529
+ * @modified 2026-01-03
1530
+ *
1531
+ * @description
1532
+ * Uses Template Method pattern to define the skeleton flow for page rendering.
1533
+ * AbstractPageRenderer defines rendering steps: renderHeader → renderBody → renderFooter
1534
+ * Subclasses implement specific steps: SinglePageRenderer, PaginatedPageRenderer
1535
+ *
1536
+ * v1.2.0 optimizations:
1537
+ * - Enhanced type safety, introduced PaginatedPageContext to eliminate non-null assertions
1538
+ * - Extracted page number formatting as configurable option
1539
+ * - Extracted common footer rendering logic
1540
+ * - Added formatPageNumber utility function
1541
+ *
1542
+ * v1.1.0 optimizations:
1543
+ * - Extracted common header rendering logic to base class
1544
+ * - Extracted CSS class name constants
1545
+ * - Improved type safety (watermark options type guard)
1546
+ * - Reduced duplicate code in subclasses
1547
+ */
1548
+
1549
+ /**
1550
+ * Page render context (base)
1551
+ * Contains all data needed during rendering
1552
+ */
1553
+ interface PageRenderContext {
1554
+ schema: PrintSchema;
1555
+ data: FormData;
1556
+ options?: RenderOptions | PdfOptions;
1557
+ pageNumber?: number;
1558
+ totalPages?: number;
1559
+ }
1560
+ /**
1561
+ * Paginated render context (type-safe)
1562
+ * pageNumber and totalPages are required, eliminating non-null assertions
1563
+ */
1564
+ interface PaginatedPageContext extends PageRenderContext {
1565
+ pageNumber: number;
1566
+ totalPages: number;
1567
+ }
1568
+ /**
1569
+ * Abstract page renderer (Template Method pattern's AbstractClass)
1570
+ * Defines page rendering skeleton, subclasses implement specific steps
1571
+ */
1572
+ declare abstract class AbstractPageRenderer {
1573
+ /**
1574
+ * Render page (Template Method)
1575
+ * Defines rendering flow: renderHeader → renderBody → renderFooter
1576
+ * @param context - Render context
1577
+ * @returns HTML string
1578
+ */
1579
+ render(context: PageRenderContext): string;
1580
+ /**
1581
+ * Render page start tag
1582
+ * @param _context - Render context (reserved for subclass override)
1583
+ */
1584
+ protected renderPageStart(_context: PageRenderContext): string;
1585
+ /**
1586
+ * Render page end tag
1587
+ * @param _context - Render context (reserved for subclass override)
1588
+ */
1589
+ protected renderPageEnd(_context: PageRenderContext): string;
1590
+ /**
1591
+ * Render header (abstract method, subclass must implement)
1592
+ * @param context - Render context
1593
+ */
1594
+ protected abstract renderHeader(context: PageRenderContext): string;
1595
+ /**
1596
+ * Render body content (abstract method, subclass must implement)
1597
+ * @param context - Render context
1598
+ */
1599
+ protected abstract renderBody(context: PageRenderContext): string;
1600
+ /**
1601
+ * Render footer (abstract method, subclass must implement)
1602
+ * @param context - Render context
1603
+ */
1604
+ protected abstract renderFooter(context: PageRenderContext): string;
1605
+ /**
1606
+ * Render watermark (hook method, subclass can optionally override)
1607
+ * Uses type guard for type safety
1608
+ * @param context - Render context
1609
+ */
1610
+ protected renderWatermark(context: PageRenderContext): string;
1611
+ /**
1612
+ * Render section list
1613
+ * @param sections - Section configuration array
1614
+ * @param data - Form data
1615
+ * @param options - Render options
1616
+ */
1617
+ protected renderSections(sections: PrintSection[], data: FormData, options?: RenderOptions): string;
1618
+ /**
1619
+ * Render header content (common logic for subclass reuse)
1620
+ * @param schema - Print configuration
1621
+ * @param titleSuffix - Title suffix (e.g., "(continued)" for continuation pages)
1622
+ * @returns Header content HTML array
1623
+ */
1624
+ protected renderHeaderContent(schema: PrintSchema, titleSuffix?: string): string[];
1625
+ /**
1626
+ * Render body content wrapper (common logic for subclass reuse)
1627
+ * @param context - Render context
1628
+ * @param sections - Sections to render
1629
+ * @returns Body HTML
1630
+ */
1631
+ protected renderBodyWrapper(context: PageRenderContext, sections: PrintSection[]): string;
1632
+ }
1633
+ /**
1634
+ * Single page renderer
1635
+ * Renders all content to a single page
1636
+ */
1637
+ declare class SinglePageRenderer extends AbstractPageRenderer {
1638
+ protected renderHeader(context: PageRenderContext): string;
1639
+ protected renderBody(context: PageRenderContext): string;
1640
+ protected renderFooter(context: PageRenderContext): string;
1641
+ }
1642
+ /**
1643
+ * Paginated renderer options
1644
+ */
1645
+ interface PaginatedRenderOptions {
1646
+ showHeaderOnEachPage?: boolean;
1647
+ showFooterOnEachPage?: boolean;
1648
+ showPageNumber?: boolean;
1649
+ }
1650
+ /**
1651
+ * Paginated renderer
1652
+ * Supports multi-page rendering with independent header/footer per page
1653
+ */
1654
+ declare class PaginatedPageRenderer extends AbstractPageRenderer {
1655
+ private pages;
1656
+ private options;
1657
+ /**
1658
+ * Set paginated content
1659
+ * @param pages - Array of section configurations per page
1660
+ */
1661
+ setPages(pages: PrintSection[][]): void;
1662
+ /**
1663
+ * Set pagination options
1664
+ */
1665
+ setOptions(options: PaginatedRenderOptions): void;
1666
+ /**
1667
+ * Render all pages
1668
+ * @param context - Render context
1669
+ * @returns HTML string
1670
+ */
1671
+ renderAll(context: PageRenderContext): string;
1672
+ /**
1673
+ * Render single page
1674
+ * Uses PaginatedPageContext to ensure pageNumber/totalPages type safety
1675
+ */
1676
+ private renderPage;
1677
+ protected renderHeader(context: PaginatedPageContext): string;
1678
+ protected renderBody(context: PageRenderContext): string;
1679
+ protected renderFooter(context: PaginatedPageContext): string;
1680
+ /**
1681
+ * Render page number only
1682
+ */
1683
+ private renderPageNumberOnly;
1684
+ }
1685
+ /**
1686
+ * Create single page renderer
1687
+ */
1688
+ declare function createSinglePageRenderer(): SinglePageRenderer;
1689
+ /**
1690
+ * Create paginated renderer
1691
+ */
1692
+ declare function createPaginatedPageRenderer(): PaginatedPageRenderer;
1693
+
1694
+ /**
1695
+ * @fileoverview Visitor pattern - Data formatting
1696
+ * @module renderer/visitors
1697
+ *
1698
+ * @modified 2023.12.15
1699
+ *
1700
+ * @description
1701
+ * Uses Visitor pattern to separate data traversal and operation logic.
1702
+ * FormDataVisitor interface defines visit methods,
1703
+ * Different Visitors implement different operations: formatting, validation, measurement, etc.
1704
+ */
1705
+
1706
+ /**
1707
+ * Field information
1708
+ */
1709
+ interface FieldInfo {
1710
+ /** Field name */
1711
+ name: string;
1712
+ /** Field value */
1713
+ value: unknown;
1714
+ /** Field type */
1715
+ type?: string;
1716
+ /** Field label */
1717
+ label?: string;
1718
+ /** Parent section */
1719
+ section?: PrintSection;
1720
+ }
1721
+ /**
1722
+ * Form data visitor interface (Visitor pattern's Visitor)
1723
+ * Defines methods for visiting different data types
1724
+ */
1725
+ interface FormDataVisitor<T = void> {
1726
+ /** Visit string field */
1727
+ visitString(field: FieldInfo): T;
1728
+ /** Visit number field */
1729
+ visitNumber(field: FieldInfo): T;
1730
+ /** Visit boolean field */
1731
+ visitBoolean(field: FieldInfo): T;
1732
+ /** Visit date field */
1733
+ visitDate(field: FieldInfo): T;
1734
+ /** Visit array field */
1735
+ visitArray(field: FieldInfo): T;
1736
+ /** Visit object field */
1737
+ visitObject(field: FieldInfo): T;
1738
+ /** Visit null field */
1739
+ visitNull(field: FieldInfo): T;
1740
+ /** Get result */
1741
+ getResult(): T;
1742
+ }
1743
+ /**
1744
+ * Format visitor
1745
+ * Formats data into display strings
1746
+ */
1747
+ declare class FormatVisitor implements FormDataVisitor<string> {
1748
+ private results;
1749
+ private dateFormat;
1750
+ private booleanSymbols;
1751
+ constructor(options?: {
1752
+ dateFormat?: string;
1753
+ booleanSymbols?: {
1754
+ true: string;
1755
+ false: string;
1756
+ };
1757
+ });
1758
+ visitString(field: FieldInfo): string;
1759
+ visitNumber(field: FieldInfo): string;
1760
+ visitBoolean(field: FieldInfo): string;
1761
+ visitDate(field: FieldInfo): string;
1762
+ visitArray(field: FieldInfo): string;
1763
+ visitObject(field: FieldInfo): string;
1764
+ visitNull(field: FieldInfo): string;
1765
+ getResult(): string;
1766
+ getFormattedData(): Map<string, string>;
1767
+ }
1768
+ /**
1769
+ * Validation result
1770
+ */
1771
+ interface ValidationResult {
1772
+ valid: boolean;
1773
+ errors: Array<{
1774
+ field: string;
1775
+ message: string;
1776
+ }>;
1777
+ }
1778
+ /**
1779
+ * Validation visitor
1780
+ * Validates data integrity
1781
+ */
1782
+ declare class ValidationVisitor implements FormDataVisitor<ValidationResult> {
1783
+ private errors;
1784
+ private requiredFields;
1785
+ constructor(requiredFields?: string[]);
1786
+ private checkRequired;
1787
+ visitString(field: FieldInfo): ValidationResult;
1788
+ visitNumber(field: FieldInfo): ValidationResult;
1789
+ visitBoolean(field: FieldInfo): ValidationResult;
1790
+ visitDate(field: FieldInfo): ValidationResult;
1791
+ visitArray(field: FieldInfo): ValidationResult;
1792
+ visitObject(field: FieldInfo): ValidationResult;
1793
+ visitNull(field: FieldInfo): ValidationResult;
1794
+ getResult(): ValidationResult;
1795
+ reset(): void;
1796
+ }
1797
+ /**
1798
+ * Measurement result
1799
+ */
1800
+ interface MeasureResult {
1801
+ /** Field name */
1802
+ field: string;
1803
+ /** Estimated character count */
1804
+ charCount: number;
1805
+ /** Estimated line count */
1806
+ lineCount: number;
1807
+ /** Estimated height (mm) */
1808
+ estimatedHeight: number;
1809
+ }
1810
+ /**
1811
+ * Measurement visitor
1812
+ * Measures content height (for pagination calculation)
1813
+ */
1814
+ declare class MeasureVisitor implements FormDataVisitor<MeasureResult[]> {
1815
+ private results;
1816
+ private lineHeight;
1817
+ private charsPerLine;
1818
+ constructor(options?: {
1819
+ lineHeight?: number;
1820
+ charsPerLine?: number;
1821
+ });
1822
+ private measure;
1823
+ visitString(field: FieldInfo): MeasureResult[];
1824
+ visitNumber(field: FieldInfo): MeasureResult[];
1825
+ visitBoolean(field: FieldInfo): MeasureResult[];
1826
+ visitDate(field: FieldInfo): MeasureResult[];
1827
+ visitArray(field: FieldInfo): MeasureResult[];
1828
+ visitObject(field: FieldInfo): MeasureResult[];
1829
+ visitNull(field: FieldInfo): MeasureResult[];
1830
+ getResult(): MeasureResult[];
1831
+ getTotalHeight(): number;
1832
+ reset(): void;
1833
+ }
1834
+ /**
1835
+ * Data traverser
1836
+ * Traverses form data and applies visitor
1837
+ */
1838
+ declare class FormDataTraverser {
1839
+ /**
1840
+ * Traverse form data
1841
+ * @param data - Form data
1842
+ * @param visitor - Visitor
1843
+ * @param sections - Section configuration (optional, for field type info)
1844
+ */
1845
+ traverse<T>(data: FormData, visitor: FormDataVisitor<T>, sections?: PrintSection[]): void;
1846
+ /**
1847
+ * Visit single field
1848
+ */
1849
+ private visitField;
1850
+ /**
1851
+ * Extract field types from section configuration
1852
+ */
1853
+ private extractFieldTypes;
1854
+ }
1855
+ /**
1856
+ * Create format visitor
1857
+ */
1858
+ declare function createFormatVisitor(options?: {
1859
+ dateFormat?: string;
1860
+ booleanSymbols?: {
1861
+ true: string;
1862
+ false: string;
1863
+ };
1864
+ }): FormatVisitor;
1865
+ /**
1866
+ * Create validation visitor
1867
+ */
1868
+ declare function createValidationVisitor(requiredFields?: string[]): ValidationVisitor;
1869
+ /**
1870
+ * Create measurement visitor
1871
+ */
1872
+ declare function createMeasureVisitor(options?: {
1873
+ lineHeight?: number;
1874
+ charsPerLine?: number;
1875
+ }): MeasureVisitor;
1876
+ /**
1877
+ * Create data traverser
1878
+ */
1879
+ declare function createFormDataTraverser(): FormDataTraverser;
1880
+
1881
+ /**
1882
+ * @fileoverview Font CSS generator
1883
+ * @module fonts/font-css
1884
+ * @version 1.0.0
1885
+ * @author Kiro
1886
+ * @created 2026-01-03
1887
+ *
1888
+ * @description
1889
+ * Generates @font-face CSS declarations using embedded Base64 font data.
1890
+ * Enforces Source Han Serif SC font and disables font synthesis.
1891
+ *
1892
+ * @dependencies
1893
+ * - ./font-data - Base64 encoded font data
1894
+ */
1895
+ /** Font family name (immutable) */
1896
+ declare const FONT_FAMILY = "Source Han Serif SC";
1897
+ /** Font weight */
1898
+ declare const FONT_WEIGHT = 400;
1899
+ /** Font style */
1900
+ declare const FONT_STYLE = "normal";
1901
+ /**
1902
+ * Get font Data URL
1903
+ * @returns woff2 format data URL
1904
+ */
1905
+ declare function getFontDataUrl(): string;
1906
+ /**
1907
+ * Get complete font CSS (includes @font-face and override rules)
1908
+ * @returns Complete font CSS string
1909
+ */
1910
+ declare function getFontCss(): string;
1911
+
1912
+ /**
1913
+ * @fileoverview Font loading state management
1914
+ * @module fonts/font-loader
1915
+ * @version 1.0.0
1916
+ * @author Kiro
1917
+ * @created 2026-01-03
1918
+ *
1919
+ * @description
1920
+ * Provides font loading state checking and waiting functionality.
1921
+ * Uses FontFace API in browser environment, returns success directly in Node.js environment.
1922
+ *
1923
+ * @dependencies
1924
+ * - ./font-css - Font configuration constants
1925
+ * - ./font-data - Base64 encoded font data
1926
+ */
1927
+ /** Font load options */
1928
+ interface FontLoadOptions {
1929
+ /** Timeout in milliseconds, default 5000 */
1930
+ timeout?: number;
1931
+ }
1932
+ /** Font load error */
1933
+ declare class FontLoadError extends Error {
1934
+ readonly cause?: Error | undefined;
1935
+ constructor(message: string, cause?: Error | undefined);
1936
+ }
1937
+ /**
1938
+ * Check if font is loaded (synchronous)
1939
+ *
1940
+ * @returns Font loading status
1941
+ * - In Node.js environment, always returns true (font is embedded, no loading needed)
1942
+ * - In browser environment, returns actual loading status
1943
+ */
1944
+ declare function isFontLoaded(): boolean;
1945
+ /**
1946
+ * Wait for fonts to load
1947
+ *
1948
+ * @param options - Load options
1949
+ * @returns Promise that resolves when font is loaded
1950
+ * @throws {FontLoadError} Rejects on timeout or load failure
1951
+ *
1952
+ * @example
1953
+ * ```typescript
1954
+ * try {
1955
+ * await waitForFonts({ timeout: 3000 })
1956
+ * console.log('Font loaded successfully')
1957
+ * } catch (error) {
1958
+ * if (error instanceof FontLoadError) {
1959
+ * console.error('Font loading failed:', error.message)
1960
+ * }
1961
+ * }
1962
+ * ```
1963
+ */
1964
+ declare function waitForFonts(options?: FontLoadOptions): Promise<void>;
1965
+
1966
+ /**
1967
+ * @fileoverview Default Theme Configuration
1968
+ * @module styles/default-theme
1969
+ *
1970
+ * @description
1971
+ * Defines default theme configuration using base unit system for scalable sizes.
1972
+ * All size values are multiples of the base unit, allowing overall scaling by modifying the base unit.
1973
+ */
1974
+
1975
+ /** Default font configuration */
1976
+ declare const defaultFonts: FontConfig;
1977
+ /** Default color configuration */
1978
+ declare const defaultColors: ColorConfig;
1979
+ /** Default size multiplier configuration */
1980
+ declare const defaultMultipliers: SizeMultipliers;
1981
+ /** Default scaled theme configuration */
1982
+ declare const defaultScaledConfig: ScaledThemeConfig;
1983
+ /**
1984
+ * Generate complete theme from base unit and multiplier configuration
1985
+ * @param config - Scaled theme configuration
1986
+ * @returns Complete theme object
1987
+ */
1988
+ declare function createScaledTheme(config?: ScaledThemeConfig): Theme;
1989
+ /**
1990
+ * Quickly create scaled theme from base unit value
1991
+ * @param baseUnit - Base unit value (millimeters), default is 1
1992
+ * @returns Complete theme object
1993
+ */
1994
+ declare function createThemeWithBaseUnit(baseUnit?: number): Theme;
1995
+ /** Default theme - Standard medical form style (base unit = 1mm) */
1996
+ declare const defaultTheme: Theme;
1997
+
1998
+ /**
1999
+ * @fileoverview CSS Style Generator
2000
+ * @module styles/css-generator
2001
+ * @version 2.0.0
2002
+ * @author Kiro
2003
+ * @created 2026-01-02
2004
+ * @modified 2026-01-03
2005
+ *
2006
+ * @description
2007
+ * Generates complete CSS style strings based on theme configuration.
2008
+ * Supports base unit system, all size values are obtained from theme configuration.
2009
+ * Supports CSS isolation mode to ensure styles are not affected by external styles.
2010
+ *
2011
+ * v2.0.0 Refactoring:
2012
+ * - Use configuration-driven approach to eliminate duplicate code
2013
+ * - Unify generation logic for normal and isolated modes
2014
+ * - Extract common utility functions
2015
+ *
2016
+ * @dependencies
2017
+ * - ../types/theme - Theme type definitions
2018
+ * - ./default-theme - Default theme configuration
2019
+ * - ./page-sizes - Page size constants
2020
+ * - ./isolation - CSS isolation module
2021
+ * - ../fonts - Font module
2022
+ *
2023
+ * @usedBy
2024
+ * - ../renderer/index.ts - Renderer main entry
2025
+ * - ../pagination/paginated-renderer.ts - Paginated renderer
2026
+ */
2027
+
2028
+ /** Deep partial type */
2029
+ type DeepPartial<T> = {
2030
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
2031
+ };
2032
+ /**
2033
+ * Deep merge theme configuration
2034
+ *
2035
+ * Merges a partial custom theme with the default theme, supporting
2036
+ * deep nested property overrides.
2037
+ *
2038
+ * @param customTheme - Custom theme configuration (deep partial)
2039
+ * @returns Merged complete theme
2040
+ *
2041
+ * @example
2042
+ * ```typescript
2043
+ * import { mergeTheme, defaultTheme } from 'medical-form-printer'
2044
+ *
2045
+ * const customTheme = mergeTheme(defaultTheme, {
2046
+ * colors: {
2047
+ * primary: '#1a1a1a',
2048
+ * border: '#333333'
2049
+ * },
2050
+ * fontSize: {
2051
+ * body: '11pt'
2052
+ * }
2053
+ * })
2054
+ * ```
2055
+ */
2056
+ declare function mergeTheme(customTheme?: DeepPartial<Theme>): Theme;
2057
+ /**
2058
+ * Generate CSS style string (normal mode)
2059
+ *
2060
+ * @param theme - Theme configuration
2061
+ * @returns Complete CSS style string
2062
+ *
2063
+ * @description
2064
+ * Generated CSS includes:
2065
+ * - Base styles (reset, page layout)
2066
+ * - Header and footer styles
2067
+ * - Section type styles (info-grid, table, checkbox-grid, etc.)
2068
+ * - Print media queries
2069
+ * - Watermark styles
2070
+ *
2071
+ * All size values are obtained from theme configuration, supporting overall scaling through base unit system.
2072
+ *
2073
+ * @example
2074
+ * ```typescript
2075
+ * import { generateCss, defaultTheme, mergeTheme } from 'medical-form-printer'
2076
+ *
2077
+ * // Use default theme
2078
+ * const css = generateCss(defaultTheme)
2079
+ *
2080
+ * // Use custom theme
2081
+ * const customTheme = mergeTheme(defaultTheme, {
2082
+ * colors: { primary: '#1a1a1a' }
2083
+ * })
2084
+ * const customCss = generateCss(customTheme)
2085
+ * ```
2086
+ */
2087
+ declare function generateCss(theme: Theme): string;
2088
+ /**
2089
+ * Generate complete isolated CSS with embedded fonts and namespaced classes
2090
+ *
2091
+ * @param customTheme - Custom theme configuration (font configuration will be ignored)
2092
+ * @returns Complete CSS including font, isolation and component styles
2093
+ *
2094
+ * @description
2095
+ * Generated CSS includes:
2096
+ * 1. @font-face declaration (embedded Base64 font)
2097
+ * 2. Font force override rules
2098
+ * 3. CSS isolation container styles
2099
+ * 4. All component styles (with mpr- prefix)
2100
+ * 5. Print media queries
2101
+ *
2102
+ * Note: The fonts property in the passed theme configuration will be ignored,
2103
+ * always uses embedded Source Han Serif SC.
2104
+ *
2105
+ * @example
2106
+ * ```typescript
2107
+ * import { generateIsolatedCss, ISOLATION_ROOT_CLASS } from 'medical-form-printer'
2108
+ *
2109
+ * const css = generateIsolatedCss()
2110
+ *
2111
+ * // Use in HTML
2112
+ * const html = `
2113
+ * <style>${css}</style>
2114
+ * <div class="${ISOLATION_ROOT_CLASS}">
2115
+ * <!-- Rendered content -->
2116
+ * </div>
2117
+ * `
2118
+ * ```
2119
+ */
2120
+ declare function generateIsolatedCss(customTheme?: DeepPartial<Theme>): string;
2121
+
2122
+ /**
2123
+ * @fileoverview Base Unit System
2124
+ * @module styles/base-unit
2125
+ * @modifys 2021-06-01
2126
+ *
2127
+ * @description
2128
+ * Defines base unit constants and unit conversion functions for print rendering.
2129
+ * All size values are multiples of BASE_UNIT, allowing overall scaling by modifying BASE_UNIT.
2130
+ *
2131
+ * Design Principles:
2132
+ * - Default base unit is 1mm
2133
+ * - All sizes are defined through a multiplier system to maintain proportional relationships
2134
+ * - Supports mm, pt, px unit output
2135
+ */
2136
+ /** Supported unit types */
2137
+ type Unit = 'mm' | 'pt' | 'px';
2138
+ /** Default base unit value (millimeters) */
2139
+ declare const DEFAULT_BASE_UNIT = 1;
2140
+ /**
2141
+ * Unit conversion constants
2142
+ * - 1mm ≈ 2.835pt (72pt / 25.4mm)
2143
+ * - 1mm ≈ 3.78px (96px / 25.4mm at 96dpi)
2144
+ */
2145
+ declare const UNIT_CONVERSIONS: {
2146
+ /** Millimeters to points conversion factor */
2147
+ readonly MM_TO_PT: number;
2148
+ /** Millimeters to pixels conversion factor (96dpi) */
2149
+ readonly MM_TO_PX: number;
2150
+ /** Points to millimeters conversion factor */
2151
+ readonly PT_TO_MM: number;
2152
+ /** Pixels to millimeters conversion factor (96dpi) */
2153
+ readonly PX_TO_MM: number;
2154
+ };
2155
+ /**
2156
+ * Size multiplier configuration
2157
+ * Defines multipliers for various sizes relative to the base unit
2158
+ */
2159
+ declare const SIZE_MULTIPLIERS: {
2160
+ /** Font size multipliers */
2161
+ readonly fontSize: {
2162
+ /** Body font size - 3.5mm ≈ 10pt */
2163
+ readonly body: 3.5;
2164
+ /** Small font size - 3mm ≈ 8.5pt */
2165
+ readonly small: 3;
2166
+ /** Section title - 4.2mm ≈ 12pt */
2167
+ readonly sectionTitle: 4.2;
2168
+ /** Hospital name - 5mm ≈ 14pt */
2169
+ readonly hospitalName: 5;
2170
+ /** Form title - 5.6mm ≈ 16pt */
2171
+ readonly formTitle: 5.6;
2172
+ };
2173
+ /** Line height multiplier (relative to font size) */
2174
+ readonly lineHeight: 1.5;
2175
+ /** Spacing multipliers */
2176
+ readonly spacing: {
2177
+ /** Page margin - Using 8mm 10mm consistent with Vue component, using 10mm as base */
2178
+ readonly pageMargin: 10;
2179
+ /** Section gap - 5mm */
2180
+ readonly sectionGap: 5;
2181
+ /** Cell horizontal padding - 3mm */
2182
+ readonly cellPaddingX: 3;
2183
+ /** Cell vertical padding - 2mm */
2184
+ readonly cellPaddingY: 2;
2185
+ /** Header bottom margin - 10mm */
2186
+ readonly headerMarginBottom: 10;
2187
+ /** Department name top margin - 2mm */
2188
+ readonly departmentMarginTop: 2;
2189
+ /** Form title top margin - 5mm */
2190
+ readonly titleMarginTop: 5;
2191
+ /** Signature area gap - 20mm */
2192
+ readonly signatureGap: 20;
2193
+ /** Signature area top margin - 10mm */
2194
+ readonly signatureMarginTop: 10;
2195
+ /** Signature line minimum width - 30mm */
2196
+ readonly signatureLineWidth: 30;
2197
+ /** Free text minimum height - 20mm */
2198
+ readonly freeTextMinHeight: 20;
2199
+ /** Footer top margin - 10mm */
2200
+ readonly footerMarginTop: 10;
2201
+ /** Extra small spacing - 2mm */
2202
+ readonly xs: 2;
2203
+ /** Small spacing - 3mm */
2204
+ readonly sm: 3;
2205
+ };
2206
+ /** Border width multiplier - 0.35mm ≈ 1px */
2207
+ readonly borderWidth: 0.35;
2208
+ };
2209
+ /**
2210
+ * Convert millimeter value to specified unit
2211
+ * @param mm - Millimeter value
2212
+ * @param unit - Target unit
2213
+ * @returns Converted numeric value
2214
+ */
2215
+ declare function convertFromMm(mm: number, unit: Unit): number;
2216
+ /**
2217
+ * Convert value from specified unit to millimeters
2218
+ * @param value - Numeric value
2219
+ * @param unit - Source unit
2220
+ * @returns Millimeter value
2221
+ */
2222
+ declare function convertToMm(value: number, unit: Unit): number;
2223
+ /**
2224
+ * Calculate scaled value
2225
+ * @param multiplier - Multiplier
2226
+ * @param baseUnit - Base unit value (millimeters)
2227
+ * @returns Scaled millimeter value
2228
+ */
2229
+ declare function scaleValue(multiplier: number, baseUnit?: number): number;
2230
+ /**
2231
+ * Format size value as CSS string
2232
+ * @param mm - Millimeter value
2233
+ * @param unit - Output unit
2234
+ * @param precision - Decimal precision
2235
+ * @returns CSS size string (e.g., "10mm", "28.35pt")
2236
+ */
2237
+ declare function formatSize(mm: number, unit?: Unit, precision?: number): string;
2238
+ /**
2239
+ * Format padding value as CSS string
2240
+ * @param vertical - Vertical padding (millimeters)
2241
+ * @param horizontal - Horizontal padding (millimeters)
2242
+ * @param unit - Output unit
2243
+ * @returns CSS padding string (e.g., "2mm 3mm")
2244
+ */
2245
+ declare function formatPadding(vertical: number, horizontal: number, unit?: Unit): string;
2246
+
2247
+ /**
2248
+ * @fileoverview Inline style mapping
2249
+ * @module styles/inline-styles
2250
+ *
2251
+ * @description
2252
+ * Defines inline styles that can be directly injected into HTML element style attributes.
2253
+ * Used to generate self-contained HTML that doesn't depend on external CSS files.
2254
+ */
2255
+
2256
+ /** Style object type */
2257
+ type StyleObject = Record<string, string | number>;
2258
+ /** Inline style map type */
2259
+ interface InlineStyleMap {
2260
+ printPage: StyleObject;
2261
+ printPageLandscape: StyleObject;
2262
+ printPageA5: StyleObject;
2263
+ printPageA5Landscape: StyleObject;
2264
+ printPage16K: StyleObject;
2265
+ printPage16KLandscape: StyleObject;
2266
+ printHeader: StyleObject;
2267
+ hospitalName: StyleObject;
2268
+ departmentName: StyleObject;
2269
+ formTitle: StyleObject;
2270
+ printSection: StyleObject;
2271
+ sectionTitle: StyleObject;
2272
+ infoGridTable: StyleObject;
2273
+ infoGridTd: StyleObject;
2274
+ infoGridLabelCell: StyleObject;
2275
+ infoGridValueCell: StyleObject;
2276
+ dataTableTable: StyleObject;
2277
+ dataTableTh: StyleObject;
2278
+ dataTableTd: StyleObject;
2279
+ checkboxGrid: StyleObject;
2280
+ checkboxGridFlex: StyleObject;
2281
+ checkboxItem: StyleObject;
2282
+ checkboxSymbol: StyleObject;
2283
+ signatureArea: StyleObject;
2284
+ signatureItem: StyleObject;
2285
+ signatureLine: StyleObject;
2286
+ notesSection: StyleObject;
2287
+ notesSectionBordered: StyleObject;
2288
+ freeText: StyleObject;
2289
+ printFooter: StyleObject;
2290
+ watermark: StyleObject;
2291
+ }
2292
+ /**
2293
+ * Convert style object to CSS string
2294
+ * @param styles - Style object
2295
+ * @returns CSS string (for style attribute)
2296
+ */
2297
+ declare function styleToString(styles: StyleObject): string;
2298
+ /**
2299
+ * Merge multiple style objects
2300
+ * @param styles - Array of style objects
2301
+ * @returns Merged style object
2302
+ */
2303
+ declare function mergeStyles(...styles: (StyleObject | undefined | null)[]): StyleObject;
2304
+ /**
2305
+ * Generate inline style map based on theme
2306
+ * @param theme - Theme configuration
2307
+ * @returns Inline style map
2308
+ */
2309
+ declare function createInlineStyles(theme?: Theme): InlineStyleMap;
2310
+ /**
2311
+ * Get inline styles for page size
2312
+ * @param pageSize - Page size ('A4' | 'A5' | '16K')
2313
+ * @param orientation - Page orientation ('portrait' | 'landscape')
2314
+ * @param styles - Inline style map
2315
+ * @returns Merged page styles
2316
+ */
2317
+ declare function getPageStyles(pageSize: string, orientation: string, styles: InlineStyleMap): StyleObject;
2318
+ /** Default inline style map (using default theme) */
2319
+ declare const defaultInlineStyles: InlineStyleMap;
2320
+
2321
+ /**
2322
+ * @fileoverview CSS Isolation Module
2323
+ * @module styles/isolation
2324
+ * @version 1.0.0
2325
+ * @author Kiro
2326
+ * @created 2026-01-03
2327
+ *
2328
+ * @description
2329
+ * Provides CSS namespace and isolation container style generation.
2330
+ * Ensures component styles are completely isolated from external styles, preventing style pollution.
2331
+ *
2332
+ * @usedBy
2333
+ * - ./css-generator.ts - CSS generator
2334
+ * - ../renderer/html-renderer.ts - HTML renderer
2335
+ */
2336
+ /** CSS namespace prefix */
2337
+ declare const CSS_NAMESPACE = "mpr";
2338
+ /** Isolation container root class name */
2339
+ declare const ISOLATION_ROOT_CLASS = "mpr-root";
2340
+ /**
2341
+ * Add namespace prefix to class name
2342
+ * @param className - Original class name
2343
+ * @returns Class name with prefix
2344
+ *
2345
+ * @example
2346
+ * ```typescript
2347
+ * namespaceClass('print-page') // 'mpr-print-page'
2348
+ * namespaceClass('header') // 'mpr-header'
2349
+ * ```
2350
+ */
2351
+ declare function namespaceClass(className: string): string;
2352
+ /**
2353
+ * Batch convert class names
2354
+ * @param classNames - Original class name array
2355
+ * @returns Class name array with prefix
2356
+ *
2357
+ * @example
2358
+ * ```typescript
2359
+ * namespaceClasses(['print-page', 'header', 'footer'])
2360
+ * // ['mpr-print-page', 'mpr-header', 'mpr-footer']
2361
+ * ```
2362
+ */
2363
+ declare function namespaceClasses(classNames: string[]): string[];
2364
+ /**
2365
+ * Get namespaced class name
2366
+ * @param className - Original class name
2367
+ * @returns Namespaced class name, adds prefix if not in mapping table
2368
+ */
2369
+ declare function getNamespacedClass(className: string): string;
2370
+
2371
+ /**
2372
+ * @fileoverview Data formatters for converting values to display strings
2373
+ * @module formatters
2374
+ * @modified 2023-03-02
2375
+ */
2376
+
2377
+ /**
2378
+ * Format a date value to a string
2379
+ *
2380
+ * @param value - The date value (Date object, string, or number)
2381
+ * @param format - The format string (default: 'YYYY-MM-DD')
2382
+ * @returns Formatted date string, or empty string if value is falsy
2383
+ *
2384
+ * @example
2385
+ * ```typescript
2386
+ * formatDate('2024-01-15') // '2024-01-15'
2387
+ * formatDate(new Date(), 'YYYY/MM/DD') // '2024/01/15'
2388
+ * formatDate('2024-01-15', 'MM/DD/YYYY') // '01/15/2024'
2389
+ * ```
2390
+ */
2391
+ declare function formatDate(value: unknown, format?: string): string;
2392
+ /**
2393
+ * Format a boolean value to a checkbox symbol
2394
+ *
2395
+ * Uses ☑ (U+2611) for checked and □ (U+25A1) for unchecked,
2396
+ * consistent with Vue component rendering.
2397
+ *
2398
+ * @param value - The boolean value (truthy/falsy)
2399
+ * @returns '☑' for truthy values, '□' for falsy values
2400
+ *
2401
+ * @example
2402
+ * ```typescript
2403
+ * formatBoolean(true) // '☑'
2404
+ * formatBoolean(false) // '□'
2405
+ * formatBoolean(1) // '☑'
2406
+ * formatBoolean(null) // '□'
2407
+ * ```
2408
+ */
2409
+ declare function formatBoolean(value: unknown): string;
2410
+ /**
2411
+ * Format a number value to a string with optional precision
2412
+ *
2413
+ * @param value - The number value
2414
+ * @param precision - Number of decimal places (optional)
2415
+ * @returns Formatted number string, or empty string if value is empty/invalid
2416
+ *
2417
+ * @example
2418
+ * ```typescript
2419
+ * formatNumber(1234.567) // '1234.567'
2420
+ * formatNumber(1234.567, 2) // '1234.57'
2421
+ * formatNumber('invalid') // 'invalid'
2422
+ * formatNumber(null) // ''
2423
+ * ```
2424
+ */
2425
+ declare function formatNumber(value: unknown, precision?: number): string;
2426
+ /**
2427
+ * Format a value based on its type
2428
+ *
2429
+ * Generic formatter that handles different data types and supports
2430
+ * custom formatters for specialized formatting needs.
2431
+ *
2432
+ * @param value - The value to format
2433
+ * @param type - The data type ('text', 'checkbox', 'date', 'datetime', 'number')
2434
+ * @param options - Formatting options
2435
+ * @param options.dateFormat - Date format configuration
2436
+ * @param options.emptyPlaceholder - Placeholder for empty values (default: '')
2437
+ * @param options.customFormatters - Custom formatter functions by type
2438
+ * @returns Formatted string
2439
+ *
2440
+ * @example
2441
+ * ```typescript
2442
+ * formatValue('Hello', 'text') // 'Hello'
2443
+ * formatValue(true, 'checkbox') // '☑'
2444
+ * formatValue('2024-01-15', 'date') // '2024-01-15'
2445
+ * formatValue(null, 'text', { emptyPlaceholder: '-' }) // '-'
2446
+ * ```
2447
+ */
2448
+ declare function formatValue(value: unknown, type?: string, options?: {
2449
+ dateFormat?: DateFormatOptions;
2450
+ emptyPlaceholder?: string;
2451
+ customFormatters?: Record<string, (value: unknown) => string>;
2452
+ }): string;
2453
+ /**
2454
+ * Check if a value is checked/selected for a given option
2455
+ *
2456
+ * Handles both array values (multiple selection) and single values.
2457
+ *
2458
+ * @param values - The value(s) to check (array or single value)
2459
+ * @param optionValue - The option value to check against
2460
+ * @returns true if the option is selected, false otherwise
2461
+ *
2462
+ * @example
2463
+ * ```typescript
2464
+ * isChecked(['a', 'b', 'c'], 'b') // true
2465
+ * isChecked(['a', 'b', 'c'], 'd') // false
2466
+ * isChecked('yes', 'yes') // true
2467
+ * isChecked('no', 'yes') // false
2468
+ * ```
2469
+ */
2470
+ declare function isChecked(values: unknown, optionValue: string): boolean;
2471
+
2472
+ /** @deprecated Use PAGINATION_DEFAULTS.DPI instead */
2473
+ declare const DEFAULT_DPI: 96;
2474
+ /** @deprecated Use PAGINATION_DEFAULTS.MM_PER_INCH instead */
2475
+ declare const MM_PER_INCH: 25.4;
2476
+ /**
2477
+ * Measurable content item type enum
2478
+ * @requirements 9.1 - Identify different types of content items
2479
+ */
2480
+ declare const MEASURABLE_ITEM_TYPES: {
2481
+ readonly HEADER: "header";
2482
+ readonly SECTION: "section";
2483
+ readonly TABLE_HEADER: "table-header";
2484
+ readonly TABLE_ROW: "table-row";
2485
+ readonly SIGNATURE: "signature";
2486
+ readonly FOOTER: "footer";
2487
+ };
2488
+ /**
2489
+ * Measurable content item type
2490
+ * @requirements 9.1 - Identify different types of content items
2491
+ */
2492
+ type MeasurableItemType = (typeof MEASURABLE_ITEM_TYPES)[keyof typeof MEASURABLE_ITEM_TYPES];
2493
+ /**
2494
+ * Page dimension configuration
2495
+ * @requirements 9.5 - Support configurable page sizes
2496
+ */
2497
+ interface PageDimensions {
2498
+ /** Page width (mm) */
2499
+ width: number;
2500
+ /** Page height (mm) */
2501
+ height: number;
2502
+ /** Top margin (mm) */
2503
+ marginTop: number;
2504
+ /** Bottom margin (mm) */
2505
+ marginBottom: number;
2506
+ /** Left margin (mm) */
2507
+ marginLeft: number;
2508
+ /** Right margin (mm) */
2509
+ marginRight: number;
2510
+ }
2511
+ /**
2512
+ * Measurable content item
2513
+ * @requirements 9.7 - Support pre-measuring content height
2514
+ */
2515
+ interface MeasurableItem {
2516
+ /** Unique identifier */
2517
+ id: string;
2518
+ /** Content type */
2519
+ type: MeasurableItemType;
2520
+ /** Measured height (px) */
2521
+ height: number;
2522
+ /** Parent table ID (only for table-header and table-row) */
2523
+ tableId?: string;
2524
+ /** Original data index */
2525
+ dataIndex?: number;
2526
+ }
2527
+ /**
2528
+ * Single page content
2529
+ * @requirements 9.1 - Pagination result contains page content list
2530
+ */
2531
+ interface PageContent {
2532
+ /** Page number (starting from 1) */
2533
+ pageNumber: number;
2534
+ /** Whether this is a continuation page */
2535
+ isContinuation: boolean;
2536
+ /** List of content item IDs on this page */
2537
+ items: string[];
2538
+ /** List of table header IDs to repeat */
2539
+ repeatedHeaders: string[];
2540
+ }
2541
+ /**
2542
+ * Pagination result
2543
+ * @requirements 9.1 - Return paginated page list
2544
+ */
2545
+ interface PageBreakResult {
2546
+ /** Page list */
2547
+ pages: PageContent[];
2548
+ /** Total page count */
2549
+ totalPages: number;
2550
+ }
2551
+ /**
2552
+ * Overflow field configuration
2553
+ * Specifies which fields need pagination handling when content is too long
2554
+ * @requirements 9.7 - Support overflow field pagination
2555
+ */
2556
+ interface OverflowFieldConfig {
2557
+ /** Field name */
2558
+ fieldName: string;
2559
+ /** Maximum characters to show on first page, default 60 */
2560
+ maxFirstLineChars?: number;
2561
+ }
2562
+ /**
2563
+ * Overflow configuration
2564
+ * Configures pagination behavior when field content overflows
2565
+ */
2566
+ interface OverflowConfig {
2567
+ /** Which fields should overflow to next page */
2568
+ fields?: string[];
2569
+ /** Maximum characters to show on first page, default 60 */
2570
+ firstLineChars?: number;
2571
+ }
2572
+ /**
2573
+ * Display configuration
2574
+ * Configures elements to display on each page
2575
+ */
2576
+ interface DisplayConfig {
2577
+ /** Whether to show header on each page */
2578
+ headerOnEachPage?: boolean;
2579
+ /** Whether to show footer on each page */
2580
+ footerOnEachPage?: boolean;
2581
+ /** Whether to show signature area at bottom of each page */
2582
+ signatureOnEachPage?: boolean;
2583
+ /** Whether to repeat table headers on continuation pages */
2584
+ repeatTableHeaders?: boolean;
2585
+ }
2586
+ /**
2587
+ * Page header configuration
2588
+ * Configures header display on each page
2589
+ */
2590
+ interface PageHeaderConfig {
2591
+ /** Whether to show header on each page */
2592
+ showOnEachPage: boolean;
2593
+ /** Continuation page title suffix, e.g., "(continued)" */
2594
+ continuationSuffix?: string;
2595
+ }
2596
+ /**
2597
+ * Page footer configuration
2598
+ * Configures footer display on each page
2599
+ */
2600
+ interface PageFooterConfig {
2601
+ /** Whether to show footer on each page */
2602
+ showOnEachPage: boolean;
2603
+ /** Page number format, e.g., "Page {current} of {total}" */
2604
+ pageNumberFormat?: string;
2605
+ }
2606
+ /**
2607
+ * Smart pagination configuration
2608
+ * Enables measurement-based smart pagination
2609
+ */
2610
+ interface SmartPaginationConfig {
2611
+ /** Whether to enable smart pagination */
2612
+ enabled: boolean;
2613
+ /** Minimum table row height estimate (mm), for estimation, default 8 */
2614
+ minRowHeight?: number;
2615
+ }
2616
+ /**
2617
+ * Pagination configuration
2618
+ * @requirements 9.1, 9.5 - Support configurable pagination rules
2619
+ */
2620
+ interface PaginationConfig {
2621
+ /** Whether to enable pagination */
2622
+ enabled: boolean;
2623
+ /** Pagination mode: auto | manual (specify break points) */
2624
+ mode?: 'auto' | 'manual';
2625
+ /** In manual mode, page break after these section indices (0-based) */
2626
+ pageBreaks?: number[];
2627
+ /** Overflow configuration */
2628
+ overflow?: OverflowConfig;
2629
+ /** Display configuration */
2630
+ display?: DisplayConfig;
2631
+ /** Smart pagination configuration */
2632
+ smartPagination?: SmartPaginationConfig;
2633
+ /** Header configuration */
2634
+ headerConfig?: PageHeaderConfig;
2635
+ /** Footer configuration */
2636
+ footerConfig?: PageFooterConfig;
2637
+ /** @deprecated Use overflow.fields instead */
2638
+ overflowFields?: string[];
2639
+ /** @deprecated Use overflow.firstLineChars instead */
2640
+ overflowFirstLineChars?: number;
2641
+ /** @deprecated Use display.headerOnEachPage instead */
2642
+ showHeaderOnEachPage?: boolean;
2643
+ /** @deprecated Use display.footerOnEachPage instead */
2644
+ showFooterOnEachPage?: boolean;
2645
+ /** @deprecated Use display.signatureOnEachPage instead */
2646
+ showSignatureOnEachPage?: boolean;
2647
+ /** @deprecated Use display.repeatTableHeaders instead */
2648
+ repeatTableHeaders?: boolean;
2649
+ }
2650
+ /**
2651
+ * Page break calculation options
2652
+ * Parameters for calculatePageBreaks function
2653
+ * @requirements 9.1 - Pagination calculation parameters
2654
+ */
2655
+ interface PageBreakOptions {
2656
+ /** Available page height (px) */
2657
+ pageHeight: number;
2658
+ /** Header height (px), default 0 */
2659
+ headerHeight?: number;
2660
+ /** Footer height (px), default 0 */
2661
+ footerHeight?: number;
2662
+ /** Whether to repeat table headers, default true */
2663
+ repeatTableHeaders?: boolean;
2664
+ }
2665
+ /**
2666
+ * Page size preset name
2667
+ */
2668
+ type PageSizePreset = '16K' | 'A4' | 'A5';
2669
+
2670
+ /**
2671
+ * @fileoverview Page dimension configuration and unit conversion
2672
+ * @module pagination/page-dimensions
2673
+ * @version 1.0.0
2674
+ * @author Kiro
2675
+ * @created 2026-01-03
2676
+ * @modified 2026-01-03
2677
+ *
2678
+ * @description
2679
+ * Provides page size presets and unit conversion functions:
2680
+ * - 16K (Sixteen-mo): 185mm × 260mm - Common format for medical forms
2681
+ * - A4: 210mm × 297mm
2682
+ * - A5: 148mm × 210mm
2683
+ * - mm to px unit conversion
2684
+ * - Usable height/width calculation
2685
+ *
2686
+ * @requirements
2687
+ * - 3.1: Support A4, A5, 16K page sizes
2688
+ * - 3.6: Use 16K as default page size
2689
+ * - 9.5: Support configurable page sizes
2690
+ *
2691
+ * @dependencies
2692
+ * - ./types.ts - Type definitions and constants
2693
+ *
2694
+ * @usedBy
2695
+ * - ./index.ts - Module entry
2696
+ * - ./page-break-calculator.ts - Pagination algorithm
2697
+ * - ../renderer/paginated-renderer.ts - Paginated renderer
2698
+ */
2699
+
2700
+ /**
2701
+ * 16K (Sixteen-mo) paper configuration
2702
+ * Size: 185mm × 260mm
2703
+ * Common format for medical forms
2704
+ * @requirements 3.6 - Use 16K as default page size
2705
+ */
2706
+ declare const PAGE_16K: PageDimensions;
2707
+ /**
2708
+ * A4 paper configuration
2709
+ * Size: 210mm × 297mm
2710
+ * @requirements 3.1 - Support A4 page size
2711
+ */
2712
+ declare const PAGE_A4: PageDimensions;
2713
+ /**
2714
+ * A5 paper configuration
2715
+ * Size: 148mm × 210mm
2716
+ * @requirements 3.1 - Support A5 page size
2717
+ */
2718
+ declare const PAGE_A5: PageDimensions;
2719
+ /**
2720
+ * Page size preset mapping
2721
+ */
2722
+ declare const PAGE_PRESETS: Record<PageSizePreset, PageDimensions>;
2723
+ /**
2724
+ * Convert millimeters to pixels
2725
+ * @param mm - Millimeter value
2726
+ * @param dpi - DPI, default 96
2727
+ * @returns Pixel value
2728
+ *
2729
+ * @example
2730
+ * mmToPx(185) // => 699.21...
2731
+ * mmToPx(260) // => 982.68...
2732
+ */
2733
+ declare function mmToPx(mm: number, dpi?: number): number;
2734
+ /**
2735
+ * Convert pixels to millimeters
2736
+ * @param px - Pixel value
2737
+ * @param dpi - DPI, default 96
2738
+ * @returns Millimeter value
2739
+ *
2740
+ * @example
2741
+ * pxToMm(699.21) // => 185
2742
+ */
2743
+ declare function pxToMm(px: number, dpi?: number): number;
2744
+ /**
2745
+ * Convert millimeters to points (pt)
2746
+ * 1pt = 1/72 inch
2747
+ * @param mm - Millimeter value
2748
+ * @returns Point value
2749
+ */
2750
+ declare function mmToPt(mm: number): number;
2751
+ /**
2752
+ * Convert points (pt) to millimeters
2753
+ * @param pt - Point value
2754
+ * @returns Millimeter value
2755
+ */
2756
+ declare function ptToMm(pt: number): number;
2757
+ /**
2758
+ * Calculate usable content height (pixels)
2759
+ * @requirements 9.5 - Support configurable page sizes
2760
+ *
2761
+ * @param dimensions - Page size configuration
2762
+ * @param dpi - DPI, default 96
2763
+ * @returns Usable content height (pixels)
2764
+ */
2765
+ declare function calculateUsableHeight(dimensions?: PageDimensions, dpi?: number): number;
2766
+ /**
2767
+ * Calculate usable content width (pixels)
2768
+ * @requirements 9.5 - Support configurable page sizes
2769
+ *
2770
+ * @param dimensions - Page size configuration
2771
+ * @param dpi - DPI, default 96
2772
+ * @returns Usable content width (pixels)
2773
+ */
2774
+ declare function calculateUsableWidth(dimensions?: PageDimensions, dpi?: number): number;
2775
+ /**
2776
+ * Calculate usable content height (millimeters)
2777
+ * @param dimensions - Page size configuration
2778
+ * @returns Usable content height (millimeters)
2779
+ */
2780
+ declare function calculateUsableHeightMm(dimensions?: PageDimensions): number;
2781
+ /**
2782
+ * Calculate usable content width (millimeters)
2783
+ * @param dimensions - Page size configuration
2784
+ * @returns Usable content width (millimeters)
2785
+ */
2786
+ declare function calculateUsableWidthMm(dimensions?: PageDimensions): number;
2787
+ /**
2788
+ * Get preset configuration by page size name
2789
+ * @param pageSize - Page size name ('16K' | 'A4' | 'A5')
2790
+ * @returns Page size configuration
2791
+ */
2792
+ declare function getPageDimensions(pageSize?: PageSizePreset): PageDimensions;
2793
+ /**
2794
+ * Create custom page size configuration
2795
+ * @param width - Page width (mm)
2796
+ * @param height - Page height (mm)
2797
+ * @param margins - Margin configuration
2798
+ * @returns Page size configuration
2799
+ */
2800
+ declare function createPageDimensions(width: number, height: number, margins?: {
2801
+ top?: number;
2802
+ bottom?: number;
2803
+ left?: number;
2804
+ right?: number;
2805
+ }): PageDimensions;
2806
+
2807
+ /**
2808
+ * @fileoverview Page break algorithm core
2809
+ * @module pagination/page-break-calculator
2810
+ * @version 1.0.0
2811
+ * @author Kiro
2812
+ * @created 2026-01-03
2813
+ * @modified 2026-01-03
2814
+ *
2815
+ * @description
2816
+ * Provides core algorithms for intelligent pagination, including:
2817
+ * - Page break point calculation
2818
+ * - Table row non-splitting guarantee
2819
+ * - Continuation page header repetition
2820
+ * - Reserved header height calculation
2821
+ *
2822
+ * @requirements
2823
+ * - 9.1: Calculate page breaks based on measured content height
2824
+ * - 9.2: Ensure table rows are not split
2825
+ * - 9.3: Automatically repeat headers on continuation pages
2826
+ * - 9.4: Mark continuation pages with isContinuation
2827
+ * - 9.6: Reserved header height calculation
2828
+ *
2829
+ * @dependencies
2830
+ * - ./types.ts - Type definitions
2831
+ *
2832
+ * @usedBy
2833
+ * - ./index.ts - Module entry
2834
+ * - ../renderer/paginated-renderer.ts - Paginated renderer (to be implemented)
2835
+ */
2836
+
2837
+ /**
2838
+ * Find the header item for a specific table
2839
+ * @requirements 9.3, 9.6 - Identify headers for repetition
2840
+ *
2841
+ * @param items - All content items
2842
+ * @param tableId - Table ID
2843
+ * @returns Header item, or undefined if not found
2844
+ */
2845
+ declare function findTableHeader(items: MeasurableItem[], tableId: string): MeasurableItem | undefined;
2846
+ /**
2847
+ * Build a map from table ID to header
2848
+ * @requirements 9.3 - Fast header lookup
2849
+ *
2850
+ * @param items - All content items
2851
+ * @returns Map from table ID to header item
2852
+ */
2853
+ declare function buildTableHeaderMap(items: MeasurableItem[]): Map<string, MeasurableItem>;
2854
+ /**
2855
+ * Calculate page break points
2856
+ * @requirements 9.1, 9.2, 9.3, 9.4, 9.6
2857
+ *
2858
+ * Core algorithm:
2859
+ * 1. Iterate through all content items, accumulating height
2860
+ * 2. When accumulated height exceeds available page height, create new page
2861
+ * 3. Ensure table rows are not split (move entire row to next page)
2862
+ * 4. Continuation pages need to repeat corresponding table headers (Requirements 9.3)
2863
+ * 5. Reserve header height during calculation (Requirements 9.6)
2864
+ *
2865
+ * @param items - All measurable content items
2866
+ * @param options - Page break calculation options
2867
+ * @returns Page break result
2868
+ */
2869
+ declare function calculatePageBreaks(items: MeasurableItem[], options: PageBreakOptions): PageBreakResult;
2870
+ /**
2871
+ * Simplified page break calculation (using default options)
2872
+ * @param items - All measurable content items
2873
+ * @param pageHeight - Available page height (px)
2874
+ * @param headerHeight - Header height (px), default 0
2875
+ * @param footerHeight - Footer height (px), default 0
2876
+ * @returns Page break result
2877
+ */
2878
+ declare function calculatePageBreaksSimple(items: MeasurableItem[], pageHeight: number, headerHeight?: number, footerHeight?: number): PageBreakResult;
2879
+ /**
2880
+ * Validate completeness of page break result
2881
+ * @requirements 9.1 - Ensure all items are assigned to pages
2882
+ *
2883
+ * @param items - Original content items
2884
+ * @param result - Page break result
2885
+ * @returns Whether all items are assigned
2886
+ */
2887
+ declare function validatePageBreakResult(items: MeasurableItem[], result: PageBreakResult): boolean;
2888
+ /**
2889
+ * Get actual content height of a page
2890
+ * @param page - Page content
2891
+ * @param items - All content items
2892
+ * @returns Page content height (px)
2893
+ */
2894
+ declare function getPageContentHeight(page: PageContent, items: MeasurableItem[]): number;
2895
+
2896
+ /**
2897
+ * @fileoverview Overflow field pagination handling
2898
+ * @module pagination/overflow-handler
2899
+ * @version 1.0.0
2900
+ * @author Kiro
2901
+ * @created 2026-01-03
2902
+ * @modified 2026-01-03
2903
+ *
2904
+ * @description
2905
+ * Handles pagination logic for long text fields (e.g., textarea):
2906
+ * - First page displays truncated content
2907
+ * - Continuation pages display remaining content
2908
+ * - Supports configuring truncation character count per field
2909
+ *
2910
+ * Reference frontend implementation: PrintModeForm.vue lines 130-175
2911
+ *
2912
+ * @requirements
2913
+ * - 9.1: Calculate page breaks based on measured content height
2914
+ * - 9.7: Support overflow field pagination
2915
+ *
2916
+ * @dependencies
2917
+ * - ./types.ts - Type definitions
2918
+ *
2919
+ * @usedBy
2920
+ * - ./index.ts - Module entry
2921
+ * - ../renderer/paginated-renderer.ts - Paginated renderer (to be implemented)
2922
+ */
2923
+
2924
+ /**
2925
+ * Overflow field processing result
2926
+ */
2927
+ interface OverflowFieldResult {
2928
+ /** Field name */
2929
+ fieldName: string;
2930
+ /** First page display content */
2931
+ firstLine: string;
2932
+ /** Continuation page display content */
2933
+ rest: string;
2934
+ /** Whether there is overflow content */
2935
+ hasOverflow: boolean;
2936
+ }
2937
+ /**
2938
+ * Get first page display content for overflow field
2939
+ * @requirements 9.7 - Support overflow field pagination
2940
+ *
2941
+ * @param value - Field value
2942
+ * @param maxChars - Maximum characters to display on first page
2943
+ * @returns Content to display on first page
2944
+ *
2945
+ * @example
2946
+ * getOverflowFirstLine('This is a very long text...', 60)
2947
+ */
2948
+ declare function getOverflowFirstLine(value: unknown, maxChars?: number): string;
2949
+ /**
2950
+ * Get continuation page display content for overflow field
2951
+ * @requirements 9.7 - Support overflow field pagination
2952
+ *
2953
+ * @param value - Field value
2954
+ * @param maxChars - Maximum characters to display on first page
2955
+ * @returns Content to display on continuation pages
2956
+ */
2957
+ declare function getOverflowRest(value: unknown, maxChars?: number): string;
2958
+ /**
2959
+ * Check if field has overflow content
2960
+ * @requirements 9.7 - Support overflow field pagination
2961
+ *
2962
+ * @param value - Field value
2963
+ * @param maxChars - Maximum characters to display on first page
2964
+ * @returns Whether there is overflow content to display on continuation pages
2965
+ */
2966
+ declare function hasOverflowContent(value: unknown, maxChars?: number): boolean;
2967
+ /**
2968
+ * Create overflow field configuration
2969
+ * @param fieldName - Field name
2970
+ * @param maxFirstLineChars - Maximum characters to display on first page
2971
+ * @returns Overflow field configuration
2972
+ */
2973
+ declare function createOverflowFieldConfig(fieldName: string, maxFirstLineChars?: number): OverflowFieldConfig;
2974
+ /**
2975
+ * Create overflow field configuration list from field name array
2976
+ * @param fieldNames - Array of field names
2977
+ * @param defaultMaxChars - Default maximum characters
2978
+ * @returns Overflow field configuration list
2979
+ */
2980
+ declare function createOverflowFieldConfigs(fieldNames: string[], defaultMaxChars?: number): OverflowFieldConfig[];
2981
+ /**
2982
+ * Get overflow configuration for a field
2983
+ * @param configs - Overflow field configuration list
2984
+ * @param fieldName - Field name
2985
+ * @returns Overflow field configuration, or undefined if not found
2986
+ */
2987
+ declare function getOverflowFieldConfig(configs: OverflowFieldConfig[], fieldName: string): OverflowFieldConfig | undefined;
2988
+ /**
2989
+ * Check if field is configured as overflow field
2990
+ * @param configs - Overflow field configuration list
2991
+ * @param fieldName - Field name
2992
+ * @returns Whether it is an overflow field
2993
+ */
2994
+ declare function isOverflowField(configs: OverflowFieldConfig[], fieldName: string): boolean;
2995
+ /**
2996
+ * Batch process overflow fields
2997
+ * @param data - Form data
2998
+ * @param configs - Overflow field configuration list
2999
+ * @returns Overflow field processing result list
3000
+ */
3001
+ declare function processOverflowFields(data: Record<string, unknown>, configs: OverflowFieldConfig[]): OverflowFieldResult[];
3002
+ /**
3003
+ * Check if any overflow content needs continuation pages
3004
+ * @param data - Form data
3005
+ * @param configs - Overflow field configuration list
3006
+ * @returns Whether continuation pages are needed
3007
+ */
3008
+ declare function hasAnyOverflowContent(data: Record<string, unknown>, configs: OverflowFieldConfig[]): boolean;
3009
+
3010
+ /**
3011
+ * @fileoverview Paginated renderer
3012
+ * @module pagination/paginated-renderer
3013
+ * @version 1.1.0
3014
+ * @author Kiro
3015
+ * @created 2026-01-02
3016
+ * @modified 2026-01-03
3017
+ *
3018
+ * @description
3019
+ * Renders pagination results to multi-page HTML, each page independent and printable.
3020
+ * Supports:
3021
+ * - Independent .print-page element for each page
3022
+ * - Header rendering on each page (continuation pages add "(continued)" marker)
3023
+ * - Footer rendering on each page (page number display)
3024
+ * - Automatic table header insertion on continuation pages
3025
+ * - CSS pagination rules
3026
+ *
3027
+ * @requirements
3028
+ * - 11.1: Render each page as independent .print-page element
3029
+ * - 11.2: Automatically insert table headers on continuation pages
3030
+ * - 11.3: Display page numbers ("Page X of Y")
3031
+ * - 11.4: Add "(continued)" marker to continuation page titles
3032
+ * - 11.5: Support CSS page-break rules
3033
+ * - 11.6: Maintain consistent styles across pages
3034
+ *
3035
+ * @dependencies
3036
+ * - ./types.ts - Type definitions
3037
+ * - ./page-break-calculator.ts - Pagination algorithm
3038
+ * - ../renderer/section-renderers - Section renderers
3039
+ * - ../styles - Style system
3040
+ * - ../utils/html-builder.ts - HTML builder
3041
+ *
3042
+ * @usedBy
3043
+ * - ../index.ts - Library main entry
3044
+ * - international-postpartum-frontend - Frontend print module
3045
+ */
3046
+
3047
+ /**
3048
+ * Paginated render configuration
3049
+ */
3050
+ interface PaginatedRenderConfig {
3051
+ /** Whether to show header on each page */
3052
+ showHeaderOnEachPage?: boolean;
3053
+ /** Whether to show footer on each page */
3054
+ showFooterOnEachPage?: boolean;
3055
+ /** Whether to show signature area on each page */
3056
+ showSignatureOnEachPage?: boolean;
3057
+ /** Continuation page title suffix, default "(continued)" */
3058
+ continuationSuffix?: string;
3059
+ /** Page number format, default "Page {current} of {total}" */
3060
+ pageNumberFormat?: string;
3061
+ /** Page dimensions configuration */
3062
+ pageDimensions?: PageDimensions;
3063
+ /**
3064
+ * Whether to enable isolation mode
3065
+ * When enabled:
3066
+ * - All class names have mpr- prefix
3067
+ * - Styles are fully isolated, unaffected by external styles
3068
+ * - Fonts forced to use embedded Source Han Serif SC
3069
+ * @default false
3070
+ */
3071
+ isolated?: boolean;
3072
+ }
3073
+ /**
3074
+ * Paginated render context
3075
+ */
3076
+ interface PaginatedRenderContext {
3077
+ /** Print layout configuration */
3078
+ schema: PrintSchema;
3079
+ /** Form data */
3080
+ data: FormData;
3081
+ /** Render options */
3082
+ options?: RenderOptions;
3083
+ /** Pagination result */
3084
+ pageBreakResult: PageBreakResult;
3085
+ /** All measurable content items */
3086
+ measuredItems: MeasurableItem[];
3087
+ /** Paginated render configuration */
3088
+ config?: PaginatedRenderConfig;
3089
+ }
3090
+ /**
3091
+ * Default paginated render configuration
3092
+ */
3093
+ declare const DEFAULT_PAGINATED_RENDER_CONFIG: Required<PaginatedRenderConfig>;
3094
+ /**
3095
+ * Render paginated HTML
3096
+ * @requirements 11.1, 11.2, 11.3, 11.4, 11.5, 11.6
3097
+ * @requirements 3.1, 4.2 - CSS isolation and font embedding (isolation mode)
3098
+ *
3099
+ * @param context - Paginated render context
3100
+ * @returns Complete paginated HTML string
3101
+ *
3102
+ * @example
3103
+ * // Normal mode
3104
+ * const html = renderPaginatedHtml({
3105
+ * schema: printSchema,
3106
+ * data: formData,
3107
+ * pageBreakResult: calculatePageBreaks(items, options),
3108
+ * measuredItems: items,
3109
+ * config: { showHeaderOnEachPage: true }
3110
+ * })
3111
+ *
3112
+ * @example
3113
+ * // Isolation mode - all class names have mpr- prefix, styles fully isolated
3114
+ * const html = renderPaginatedHtml({
3115
+ * schema: printSchema,
3116
+ * data: formData,
3117
+ * pageBreakResult: calculatePageBreaks(items, options),
3118
+ * measuredItems: items,
3119
+ * config: { isolated: true }
3120
+ * })
3121
+ */
3122
+ declare function renderPaginatedHtml(context: PaginatedRenderContext): string;
3123
+ /**
3124
+ * Generate pagination-related CSS rules
3125
+ * @requirements 11.5, 11.6 - CSS page-break rules
3126
+ * @param isolated - Whether to enable isolation mode (class names have mpr- prefix)
3127
+ */
3128
+ declare function generatePaginationCss(isolated?: boolean): string;
3129
+ /**
3130
+ * Simplified paginated render function
3131
+ * For scenarios where pagination result is already available
3132
+ */
3133
+ declare function renderPaginatedHtmlSimple(schema: PrintSchema, data: FormData, pageBreakResult: PageBreakResult, measuredItems: MeasurableItem[], options?: RenderOptions, config?: PaginatedRenderConfig): string;
3134
+ /**
3135
+ * Create PaginatedRenderConfig from PaginationConfig
3136
+ */
3137
+ declare function createRenderConfigFromPaginationConfig(paginationConfig?: PaginationConfig): PaginatedRenderConfig;
3138
+
3139
+ /**
3140
+ * @fileoverview Pagination module entry point
3141
+ * @module pagination
3142
+ * @version 1.0.0
3143
+ * @author Kiro
3144
+ * @created 2026-01-03
3145
+ * @modified 2026-01-03
3146
+ *
3147
+ * @description
3148
+ * Exports all pagination-related types and functions:
3149
+ * - Type definitions
3150
+ * - Page size configuration
3151
+ * - Pagination algorithm
3152
+ * - Overflow field handling
3153
+ *
3154
+ * @requirements
3155
+ * - 9.1: Calculate page breaks based on measured content height
3156
+ *
3157
+ * @usedBy
3158
+ * - ../index.ts - Library main entry
3159
+ * - international-postpartum-frontend - Frontend print module
3160
+ */
3161
+
3162
+ /**
3163
+ * Print pagination utility function collection
3164
+ * Provides Vue Composable-like API style
3165
+ *
3166
+ * @param dimensions - Page size configuration, default 16K
3167
+ * @returns Pagination utility functions
3168
+ *
3169
+ * @example
3170
+ * const { calculateBreaks, usableHeight } = usePrintPagination()
3171
+ * const result = calculateBreaks(measuredItems, usableHeight)
3172
+ */
3173
+ declare function usePrintPagination(dimensions?: PageDimensions): {
3174
+ /** Page size configuration */
3175
+ dimensions: PageDimensions;
3176
+ /** Usable content height (px) */
3177
+ usableHeight: number;
3178
+ /** Usable content width (px) */
3179
+ usableWidth: number;
3180
+ /** Calculate pagination */
3181
+ calculateBreaks: (items: MeasurableItem[], headerHeight?: number, footerHeight?: number) => PageBreakResult;
3182
+ /** mm to px */
3183
+ mmToPx: typeof mmToPx;
3184
+ /** px to mm */
3185
+ pxToMm: typeof pxToMm;
3186
+ };
3187
+
3188
+ export { AbstractPageRenderer, CSS_NAMESPACE, type CellType, type CheckboxGridConfig, type CheckboxOption, type ColorConfig, type ColumnConfig, ContainerSection, DEFAULT_BASE_UNIT, DEFAULT_DPI, DEFAULT_PAGINATED_RENDER_CONFIG, type DateFormatOptions, FONT_FAMILY, FONT_STYLE, FONT_WEIGHT, type FieldInfo, type FontConfig, FontLoadError, type FontLoadOptions, type FontSizeConfig, type FooterConfig, type FormData, FormDataTraverser, type FormDataVisitor, FormatVisitor, type Formatter, type FormatterConfig, FormatterFactory, type FreeTextConfig, type HeaderConfig, HtmlBuilder, HtmlElementBuilder, ISOLATION_ROOT_CLASS, type InfoGridCell, type InfoGridConfig, type InfoGridRow, type InlineStyleMap, type IsolatedRenderOptions, LeafSection, MM_PER_INCH, type MeasurableItem, type MeasurableItemType, type MeasureResult, MeasureVisitor, type MergeDocumentItem, type MergeOptions, type NotesConfig, type OverflowFieldConfig, type OverflowFieldResult, PAGE_16K, PAGE_A4, PAGE_A5, PAGE_PRESETS, type PageBreakOptions, type PageBreakResult, PageBuilder, type PageConfig, type PageContent, type PageDimensions, type PageFooterConfig, type PageHeaderConfig, type PageOrientation, type PageRenderContext, type PageSize, PaginatedPageRenderer, type PaginatedRenderConfig, type PaginatedRenderContext, type PaginationConfig, type PdfOptions, type PrintFooter, type PrintHeader, type PrintSchema, type PrintSection, type RenderOptions, type RendererCreator, SIZE_MULTIPLIERS, type ScaledThemeConfig, type SectionComponent, type SectionConfig, type SectionRenderStrategy, type SectionRenderer, SectionRendererFactory, SectionTreeTraverser, type SectionType, type SignatureConfig, type SignatureField, SinglePageRenderer, type SizeMultipliers, type SmartPaginationConfig, type SpacingConfig, StrategyContext, type StyleObject, TableBuilder, type TableColumn, type TableConfig$1 as TableConfig, type Theme, UNIT_CONVERSIONS, type Unit, type ValidationResult, ValidationVisitor, type WatermarkOptions, buildTableHeaderMap, calculatePageBreaks, calculatePageBreaksSimple, calculateUsableHeight, calculateUsableHeightMm, calculateUsableWidth, calculateUsableWidthMm, clamp, convertFromMm, convertToMm, createDefaultStrategyContext, createFormDataTraverser, createFormatVisitor, createInlineStyles, createMeasureVisitor, createOverflowFieldConfig, createOverflowFieldConfigs, createPageDimensions, createPaginatedPageRenderer, createRenderConfigFromPaginationConfig, createScaledTheme, createSectionComponent, createSectionTree, createSinglePageRenderer, createThemeWithBaseUnit, createValidationVisitor, defaultColors, defaultFonts, defaultInlineStyles, defaultMultipliers, defaultScaledConfig, defaultTheme, div, each, escapeAttr, escapeHtml, extractWatermarkOptions, findTableHeader, footer, formatBoolean, formatDate, formatNumber, formatPadding, formatSize, formatValue, fragment, generateCss, generateIsolatedCss, generatePaginationCss, getDefaultFormatterFactory, getDefaultSectionRendererFactory, getFontCss, getFontDataUrl, getNamespacedClass, getOverflowFieldConfig, getOverflowFirstLine, getOverflowRest, getPageContentHeight, getPageDimensions, getPageStyles, getSectionRenderer, h, h1, hasAnyOverflowContent, hasOverflowContent, header, isChecked, isFontLoaded, isOverflowField, main, mergeStyles, mergeTheme, mmToPt, mmToPx, namespaceClass, namespaceClasses, normalizeOpacity, p, processOverflowFields, ptToMm, pxToMm, registerSectionRenderer, renderPaginatedHtml, renderPaginatedHtmlSimple, renderSectionTree, renderToHtml, renderToIsolatedFragment, renderToIsolatedHtml, renderWatermarkHtml, scaleValue, span, styleToString, table, tbody, td, th, thead, tr, usePrintPagination, validatePageBreakResult, waitForFonts, when };