@formepdf/react 0.10.5 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/font.d.ts +2 -11
- package/dist/font.js +1 -23
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/serialize.d.ts +1 -6
- package/dist/serialize.js +7 -1196
- package/dist/types.d.ts +4 -822
- package/package.json +4 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,213 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { FontRegistration } from './font.js';
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
top: number;
|
|
6
|
-
right: number;
|
|
7
|
-
bottom: number;
|
|
8
|
-
left: number;
|
|
9
|
-
}
|
|
10
|
-
/** Corner values for borderRadius */
|
|
11
|
-
export interface Corners {
|
|
12
|
-
topLeft: number;
|
|
13
|
-
topRight: number;
|
|
14
|
-
bottomRight: number;
|
|
15
|
-
bottomLeft: number;
|
|
16
|
-
}
|
|
17
|
-
/** A single CSS Grid track size */
|
|
18
|
-
export type GridTrackSize = number | `${number}fr` | 'auto' | {
|
|
19
|
-
min: GridTrackSize;
|
|
20
|
-
max: GridTrackSize;
|
|
21
|
-
};
|
|
22
|
-
/** Per-edge colors for borderColor */
|
|
23
|
-
export interface EdgeColors {
|
|
24
|
-
top: string;
|
|
25
|
-
right: string;
|
|
26
|
-
bottom: string;
|
|
27
|
-
left: string;
|
|
28
|
-
}
|
|
29
|
-
/** CSS-like style properties for Forme components */
|
|
30
|
-
export interface Style {
|
|
31
|
-
display?: 'flex' | 'grid';
|
|
32
|
-
width?: number | string;
|
|
33
|
-
height?: number | string;
|
|
34
|
-
minWidth?: number | string;
|
|
35
|
-
minHeight?: number | string;
|
|
36
|
-
maxWidth?: number | string;
|
|
37
|
-
maxHeight?: number | string;
|
|
38
|
-
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
39
|
-
flex?: number;
|
|
40
|
-
flexGrow?: number;
|
|
41
|
-
flexShrink?: number;
|
|
42
|
-
flexBasis?: number | string;
|
|
43
|
-
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
44
|
-
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
45
|
-
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
|
46
|
-
alignSelf?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
|
47
|
-
alignContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch';
|
|
48
|
-
gap?: number;
|
|
49
|
-
rowGap?: number;
|
|
50
|
-
columnGap?: number;
|
|
51
|
-
/** Column track definitions. String shorthand: `"1fr 2fr 200"` or array of track sizes. */
|
|
52
|
-
gridTemplateColumns?: string | GridTrackSize[];
|
|
53
|
-
/** Row track definitions. String shorthand: `"auto 1fr"` or array of track sizes. */
|
|
54
|
-
gridTemplateRows?: string | GridTrackSize[];
|
|
55
|
-
/** Default size for auto-generated rows. */
|
|
56
|
-
gridAutoRows?: GridTrackSize;
|
|
57
|
-
/** Default size for auto-generated columns. */
|
|
58
|
-
gridAutoColumns?: GridTrackSize;
|
|
59
|
-
/** Grid column start line (1-based). */
|
|
60
|
-
gridColumnStart?: number;
|
|
61
|
-
/** Grid column end line (1-based). */
|
|
62
|
-
gridColumnEnd?: number;
|
|
63
|
-
/** Grid row start line (1-based). */
|
|
64
|
-
gridRowStart?: number;
|
|
65
|
-
/** Grid row end line (1-based). */
|
|
66
|
-
gridRowEnd?: number;
|
|
67
|
-
/** Number of columns to span. */
|
|
68
|
-
gridColumnSpan?: number;
|
|
69
|
-
/** Number of rows to span. */
|
|
70
|
-
gridRowSpan?: number;
|
|
71
|
-
padding?: number | string | number[] | Edges;
|
|
72
|
-
paddingTop?: number;
|
|
73
|
-
paddingRight?: number;
|
|
74
|
-
paddingBottom?: number;
|
|
75
|
-
paddingLeft?: number;
|
|
76
|
-
paddingHorizontal?: number;
|
|
77
|
-
paddingVertical?: number;
|
|
78
|
-
margin?: number | string | number[] | Edges;
|
|
79
|
-
marginTop?: number | 'auto';
|
|
80
|
-
marginRight?: number | 'auto';
|
|
81
|
-
marginBottom?: number | 'auto';
|
|
82
|
-
marginLeft?: number | 'auto';
|
|
83
|
-
marginHorizontal?: number | 'auto';
|
|
84
|
-
marginVertical?: number | 'auto';
|
|
85
|
-
fontSize?: number;
|
|
86
|
-
fontFamily?: string;
|
|
87
|
-
fontWeight?: number | 'normal' | 'bold';
|
|
88
|
-
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
89
|
-
lineHeight?: number;
|
|
90
|
-
textAlign?: 'left' | 'center' | 'right' | 'justify';
|
|
91
|
-
letterSpacing?: number;
|
|
92
|
-
/** Extra width (points) added to each ASCII space — PDF Tw operator.
|
|
93
|
-
* Negative values tighten word gaps. When `textAlign: 'justify'` is
|
|
94
|
-
* set, the layout engine adds the computed slack-per-space on top. */
|
|
95
|
-
wordSpacing?: number;
|
|
96
|
-
/** Drop shadow painted behind the element. Object form is preferred;
|
|
97
|
-
* CSS-like string form `"offsetX offsetY blur color"` is also
|
|
98
|
-
* accepted. v1 paints a solid offset shadow only — `blur` is parsed
|
|
99
|
-
* for forward-compat but ignored. */
|
|
100
|
-
boxShadow?: string | {
|
|
101
|
-
offsetX: number;
|
|
102
|
-
offsetY: number;
|
|
103
|
-
blur?: number;
|
|
104
|
-
color: string;
|
|
105
|
-
};
|
|
106
|
-
textDecoration?: 'none' | 'underline' | 'line-through';
|
|
107
|
-
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
108
|
-
hyphens?: 'none' | 'manual' | 'auto';
|
|
109
|
-
/** Language tag (BCP 47, e.g. "en-US", "de"). Controls hyphenation dictionary. */
|
|
110
|
-
lang?: string;
|
|
111
|
-
/** Text direction for BiDi support (Arabic, Hebrew). */
|
|
112
|
-
direction?: 'ltr' | 'rtl' | 'auto';
|
|
113
|
-
/** Text overflow behavior: 'wrap' (default), 'ellipsis' (truncate with ...), 'clip' (truncate). */
|
|
114
|
-
textOverflow?: 'wrap' | 'ellipsis' | 'clip';
|
|
115
|
-
/** Line breaking algorithm: 'optimal' (Knuth-Plass, default) or 'greedy'. */
|
|
116
|
-
lineBreaking?: 'optimal' | 'greedy';
|
|
117
|
-
/** Overflow behavior: 'visible' (default) or 'hidden' (clips children to bounds). */
|
|
118
|
-
overflow?: 'visible' | 'hidden';
|
|
119
|
-
color?: string;
|
|
120
|
-
backgroundColor?: string;
|
|
121
|
-
/**
|
|
122
|
-
* CSS background. Supports:
|
|
123
|
-
* - solid colors (`"#1e293b"`, `"rgba(...)"`) — equivalent to backgroundColor
|
|
124
|
-
* - 2-stop linear gradients: `"linear-gradient(180deg, #fff 0%, #000 100%)"`
|
|
125
|
-
* - 2-stop radial gradients: `"radial-gradient(circle, #fff 0%, #000 100%)"`
|
|
126
|
-
*
|
|
127
|
-
* v1 supports exactly 2 color stops; gradients with 3+ stops fall back to
|
|
128
|
-
* the first and last stop. Multi-stop support is planned via PDF Type 3
|
|
129
|
-
* stitching functions in a follow-up.
|
|
130
|
-
*/
|
|
131
|
-
background?: string;
|
|
132
|
-
opacity?: number;
|
|
133
|
-
/**
|
|
134
|
-
* Paint-only transform applied around the element's origin (default:
|
|
135
|
-
* center). Layout flow is NOT affected — matches CSS `transform`.
|
|
136
|
-
*
|
|
137
|
-
* Accepts a CSS-like string with one or more space-separated ops:
|
|
138
|
-
* `"rotate(45deg)"`
|
|
139
|
-
* `"rotate(-15deg) scale(1.2)"`
|
|
140
|
-
* `"translate(10, -4) rotate(30deg)"`
|
|
141
|
-
*
|
|
142
|
-
* Supported ops: `rotate(<deg>deg)`, `scale(<x>[, <y>])`,
|
|
143
|
-
* `translate(<x>[, <y>])`. Angles are degrees, lengths are points.
|
|
144
|
-
*/
|
|
145
|
-
transform?: string;
|
|
146
|
-
/**
|
|
147
|
-
* Origin of the transform as fractions of the element box.
|
|
148
|
-
* `"50% 50%"` (default) = center, `"0% 0%"` = top-left, `"100% 0%"`
|
|
149
|
-
* = top-right, etc. Also accepts a tuple `[x, y]` where each is 0–1.
|
|
150
|
-
*/
|
|
151
|
-
transformOrigin?: string | [number, number];
|
|
152
|
-
borderWidth?: number | Edges;
|
|
153
|
-
borderTopWidth?: number;
|
|
154
|
-
borderRightWidth?: number;
|
|
155
|
-
borderBottomWidth?: number;
|
|
156
|
-
borderLeftWidth?: number;
|
|
157
|
-
borderColor?: string | EdgeColors;
|
|
158
|
-
borderTopColor?: string;
|
|
159
|
-
borderRightColor?: string;
|
|
160
|
-
borderBottomColor?: string;
|
|
161
|
-
borderLeftColor?: string;
|
|
162
|
-
borderRadius?: number | Corners;
|
|
163
|
-
borderTopLeftRadius?: number;
|
|
164
|
-
borderTopRightRadius?: number;
|
|
165
|
-
borderBottomRightRadius?: number;
|
|
166
|
-
borderBottomLeftRadius?: number;
|
|
167
|
-
/** CSS border shorthand, e.g. `"1px solid #000"` */
|
|
168
|
-
border?: string;
|
|
169
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
170
|
-
borderTop?: string | number;
|
|
171
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
172
|
-
borderRight?: string | number;
|
|
173
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
174
|
-
borderBottom?: string | number;
|
|
175
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
176
|
-
borderLeft?: string | number;
|
|
177
|
-
position?: 'relative' | 'absolute';
|
|
178
|
-
top?: number;
|
|
179
|
-
right?: number;
|
|
180
|
-
bottom?: number;
|
|
181
|
-
left?: number;
|
|
182
|
-
wrap?: boolean;
|
|
183
|
-
breakBefore?: boolean;
|
|
184
|
-
minWidowLines?: number;
|
|
185
|
-
minOrphanLines?: number;
|
|
186
|
-
}
|
|
187
|
-
export interface CertificationConfig {
|
|
188
|
-
/** PEM-encoded X.509 certificate. */
|
|
189
|
-
certificatePem: string;
|
|
190
|
-
/** PEM-encoded RSA private key (PKCS#8). */
|
|
191
|
-
privateKeyPem: string;
|
|
192
|
-
/** Reason for certification (e.g. "Approved"). */
|
|
193
|
-
reason?: string;
|
|
194
|
-
/** Location of certification (e.g. "New York, NY"). */
|
|
195
|
-
location?: string;
|
|
196
|
-
/** Contact info for the certifier. */
|
|
197
|
-
contact?: string;
|
|
198
|
-
/** Whether to show a visible signature annotation on the page. */
|
|
199
|
-
visible?: boolean;
|
|
200
|
-
/** X coordinate in points for visible signature. */
|
|
201
|
-
x?: number;
|
|
202
|
-
/** Y coordinate in points for visible signature. */
|
|
203
|
-
y?: number;
|
|
204
|
-
/** Width in points for visible signature. */
|
|
205
|
-
width?: number;
|
|
206
|
-
/** Height in points for visible signature. */
|
|
207
|
-
height?: number;
|
|
208
|
-
}
|
|
209
|
-
/** @deprecated Use CertificationConfig */
|
|
210
|
-
export type SignatureConfig = CertificationConfig;
|
|
3
|
+
import type { Style, Edges, ColumnDef, BarcodeFormat, CanvasContext, CertificationConfig } from '@formepdf/shared';
|
|
4
|
+
export type { Edges, Corners, GridTrackSize, EdgeColors, Style, CertificationConfig, SignatureConfig, ColumnDef, BarcodeFormat, ChartDataPoint, PieDataPoint, ChartSeries, DotPlotGroup, BarChartProps, LineChartProps, PieChartProps, AreaChartProps, DotPlotProps, CanvasContext, CanvasOp, TextRun, FormeFont, FormeDocument, FormeMetadata, FormePageConfig, FormePageSize, FormeEdges, FormeBoxShadow, FormeGradientStop, FormeBackground, FormeMarginEdges, FormeNode, FormeNodeKind, FormeColumnDef, FormeColumnWidth, FormeDimension, FormeColor, FormeEdgeValues, FormeCornerValues, FormeGridTrackSize, FormeGridPlacement, FormeStyle, ListMarker, FormeListMarkerType, FormeTransformOp, } from '@formepdf/shared';
|
|
211
5
|
export interface DocumentProps {
|
|
212
6
|
title?: string;
|
|
213
7
|
author?: string;
|
|
@@ -236,6 +30,8 @@ export interface PageProps {
|
|
|
236
30
|
height: number;
|
|
237
31
|
};
|
|
238
32
|
margin?: number | string | number[] | Edges;
|
|
33
|
+
/** Style applied to the page's content area (background, padding, default text styles). */
|
|
34
|
+
style?: Style;
|
|
239
35
|
/** Optional background image painted behind the page's content. URL,
|
|
240
36
|
* file path, or `data:image/...;base64,` URI. */
|
|
241
37
|
backgroundImage?: string;
|
|
@@ -260,11 +56,6 @@ export interface TextProps {
|
|
|
260
56
|
bookmark?: string;
|
|
261
57
|
children?: ReactNode;
|
|
262
58
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Marker style for an ordered or unordered list. Matches CSS
|
|
265
|
-
* `list-style-type` for the supported values.
|
|
266
|
-
*/
|
|
267
|
-
export type ListMarker = 'disc' | 'circle' | 'square' | 'none' | 'decimal' | 'lower-alpha' | 'upper-alpha' | 'lower-roman' | 'upper-roman';
|
|
268
59
|
/**
|
|
269
60
|
* An ordered (numbered) list. Children must be `<ListItem>`s.
|
|
270
61
|
*/
|
|
@@ -350,13 +141,6 @@ export interface ImageProps {
|
|
|
350
141
|
/** Alt text for accessibility. */
|
|
351
142
|
alt?: string;
|
|
352
143
|
}
|
|
353
|
-
export interface ColumnDef {
|
|
354
|
-
width: {
|
|
355
|
-
fraction: number;
|
|
356
|
-
} | {
|
|
357
|
-
fixed: number;
|
|
358
|
-
} | 'auto';
|
|
359
|
-
}
|
|
360
144
|
export interface TableProps {
|
|
361
145
|
columns?: ColumnDef[];
|
|
362
146
|
style?: Style;
|
|
@@ -402,7 +186,6 @@ export interface QrCodeProps {
|
|
|
402
186
|
color?: string;
|
|
403
187
|
style?: Style;
|
|
404
188
|
}
|
|
405
|
-
export type BarcodeFormat = 'Code128' | 'Code39' | 'EAN13' | 'EAN8' | 'Codabar';
|
|
406
189
|
export interface BarcodeProps {
|
|
407
190
|
/** The data to encode. */
|
|
408
191
|
data: string;
|
|
@@ -416,112 +199,6 @@ export interface BarcodeProps {
|
|
|
416
199
|
color?: string;
|
|
417
200
|
style?: Style;
|
|
418
201
|
}
|
|
419
|
-
/** Data point for bar and pie charts. */
|
|
420
|
-
export interface ChartDataPoint {
|
|
421
|
-
label: string;
|
|
422
|
-
value: number;
|
|
423
|
-
/** Optional per-item color (hex string). */
|
|
424
|
-
color?: string;
|
|
425
|
-
}
|
|
426
|
-
/** @deprecated Use ChartDataPoint instead (color is now optional on ChartDataPoint). */
|
|
427
|
-
export interface PieDataPoint {
|
|
428
|
-
label: string;
|
|
429
|
-
value: number;
|
|
430
|
-
color: string;
|
|
431
|
-
}
|
|
432
|
-
/** A data series for multi-series line and area charts. */
|
|
433
|
-
export interface ChartSeries {
|
|
434
|
-
name: string;
|
|
435
|
-
data: number[];
|
|
436
|
-
/** Optional series color (hex string). */
|
|
437
|
-
color?: string;
|
|
438
|
-
}
|
|
439
|
-
/** A group of (x, y) data points for dot plots. */
|
|
440
|
-
export interface DotPlotGroup {
|
|
441
|
-
name: string;
|
|
442
|
-
/** Optional group color (hex string). */
|
|
443
|
-
color?: string;
|
|
444
|
-
data: [number, number][];
|
|
445
|
-
}
|
|
446
|
-
export interface BarChartProps {
|
|
447
|
-
width: number;
|
|
448
|
-
height: number;
|
|
449
|
-
data: ChartDataPoint[];
|
|
450
|
-
/** Bar color. Default: "#1a365d". */
|
|
451
|
-
color?: string;
|
|
452
|
-
/** Show X-axis labels below bars. Default: true. */
|
|
453
|
-
showLabels?: boolean;
|
|
454
|
-
/** Show horizontal grid lines. Default: false. */
|
|
455
|
-
showGrid?: boolean;
|
|
456
|
-
/** Show value labels above bars. Default: false. */
|
|
457
|
-
showValues?: boolean;
|
|
458
|
-
/** Chart title. */
|
|
459
|
-
title?: string;
|
|
460
|
-
style?: Style;
|
|
461
|
-
}
|
|
462
|
-
export interface LineChartProps {
|
|
463
|
-
width: number;
|
|
464
|
-
height: number;
|
|
465
|
-
/** Multi-series data. */
|
|
466
|
-
series: ChartSeries[];
|
|
467
|
-
/** X-axis labels. */
|
|
468
|
-
labels: string[];
|
|
469
|
-
/** Show dots at data points. Default: false. */
|
|
470
|
-
showPoints?: boolean;
|
|
471
|
-
/** Show horizontal grid lines. Default: false. */
|
|
472
|
-
showGrid?: boolean;
|
|
473
|
-
/** Chart title. */
|
|
474
|
-
title?: string;
|
|
475
|
-
style?: Style;
|
|
476
|
-
}
|
|
477
|
-
export interface PieChartProps {
|
|
478
|
-
width: number;
|
|
479
|
-
height: number;
|
|
480
|
-
data: ChartDataPoint[];
|
|
481
|
-
/** Render as donut chart. Default: false. */
|
|
482
|
-
donut?: boolean;
|
|
483
|
-
/** Show legend. Default: false. */
|
|
484
|
-
showLegend?: boolean;
|
|
485
|
-
/** Chart title. */
|
|
486
|
-
title?: string;
|
|
487
|
-
style?: Style;
|
|
488
|
-
}
|
|
489
|
-
export interface AreaChartProps {
|
|
490
|
-
width: number;
|
|
491
|
-
height: number;
|
|
492
|
-
/** Multi-series data. */
|
|
493
|
-
series: ChartSeries[];
|
|
494
|
-
/** X-axis labels. */
|
|
495
|
-
labels: string[];
|
|
496
|
-
/** Show horizontal grid lines. Default: false. */
|
|
497
|
-
showGrid?: boolean;
|
|
498
|
-
/** Chart title. */
|
|
499
|
-
title?: string;
|
|
500
|
-
style?: Style;
|
|
501
|
-
}
|
|
502
|
-
export interface DotPlotProps {
|
|
503
|
-
width: number;
|
|
504
|
-
height: number;
|
|
505
|
-
/** Groups of (x, y) data points. */
|
|
506
|
-
groups: DotPlotGroup[];
|
|
507
|
-
/** Minimum X value. Auto-computed if omitted. */
|
|
508
|
-
xMin?: number;
|
|
509
|
-
/** Maximum X value. Auto-computed if omitted. */
|
|
510
|
-
xMax?: number;
|
|
511
|
-
/** Minimum Y value. Auto-computed if omitted. */
|
|
512
|
-
yMin?: number;
|
|
513
|
-
/** Maximum Y value. Auto-computed if omitted. */
|
|
514
|
-
yMax?: number;
|
|
515
|
-
/** X-axis label. */
|
|
516
|
-
xLabel?: string;
|
|
517
|
-
/** Y-axis label. */
|
|
518
|
-
yLabel?: string;
|
|
519
|
-
/** Show legend. Default: false. */
|
|
520
|
-
showLegend?: boolean;
|
|
521
|
-
/** Dot radius in points. Default: 4. */
|
|
522
|
-
dotSize?: number;
|
|
523
|
-
style?: Style;
|
|
524
|
-
}
|
|
525
202
|
export interface TextFieldProps {
|
|
526
203
|
/** Unique field name (used as the PDF field identifier). */
|
|
527
204
|
name: string;
|
|
@@ -601,504 +278,9 @@ export interface WatermarkProps {
|
|
|
601
278
|
angle?: number;
|
|
602
279
|
style?: Style;
|
|
603
280
|
}
|
|
604
|
-
/** Canvas drawing context for the draw callback. */
|
|
605
|
-
export interface CanvasContext {
|
|
606
|
-
moveTo(x: number, y: number): void;
|
|
607
|
-
lineTo(x: number, y: number): void;
|
|
608
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
609
|
-
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
|
|
610
|
-
closePath(): void;
|
|
611
|
-
rect(x: number, y: number, w: number, h: number): void;
|
|
612
|
-
circle(cx: number, cy: number, r: number): void;
|
|
613
|
-
ellipse(cx: number, cy: number, rx: number, ry: number): void;
|
|
614
|
-
arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
|
|
615
|
-
/** Convenience: draws a stroked line from (x1,y1) to (x2,y2). */
|
|
616
|
-
line(x1: number, y1: number, x2: number, y2: number): void;
|
|
617
|
-
stroke(): void;
|
|
618
|
-
fill(): void;
|
|
619
|
-
fillAndStroke(): void;
|
|
620
|
-
setFillColor(r: number, g: number, b: number): void;
|
|
621
|
-
setStrokeColor(r: number, g: number, b: number): void;
|
|
622
|
-
setLineWidth(w: number): void;
|
|
623
|
-
setLineCap(cap: number): void;
|
|
624
|
-
setLineJoin(join: number): void;
|
|
625
|
-
save(): void;
|
|
626
|
-
restore(): void;
|
|
627
|
-
}
|
|
628
|
-
/** A single canvas drawing operation (serialized to JSON). */
|
|
629
|
-
export type CanvasOp = {
|
|
630
|
-
op: 'MoveTo';
|
|
631
|
-
x: number;
|
|
632
|
-
y: number;
|
|
633
|
-
} | {
|
|
634
|
-
op: 'LineTo';
|
|
635
|
-
x: number;
|
|
636
|
-
y: number;
|
|
637
|
-
} | {
|
|
638
|
-
op: 'BezierCurveTo';
|
|
639
|
-
cp1x: number;
|
|
640
|
-
cp1y: number;
|
|
641
|
-
cp2x: number;
|
|
642
|
-
cp2y: number;
|
|
643
|
-
x: number;
|
|
644
|
-
y: number;
|
|
645
|
-
} | {
|
|
646
|
-
op: 'QuadraticCurveTo';
|
|
647
|
-
cpx: number;
|
|
648
|
-
cpy: number;
|
|
649
|
-
x: number;
|
|
650
|
-
y: number;
|
|
651
|
-
} | {
|
|
652
|
-
op: 'ClosePath';
|
|
653
|
-
} | {
|
|
654
|
-
op: 'Rect';
|
|
655
|
-
x: number;
|
|
656
|
-
y: number;
|
|
657
|
-
width: number;
|
|
658
|
-
height: number;
|
|
659
|
-
} | {
|
|
660
|
-
op: 'Circle';
|
|
661
|
-
cx: number;
|
|
662
|
-
cy: number;
|
|
663
|
-
r: number;
|
|
664
|
-
} | {
|
|
665
|
-
op: 'Ellipse';
|
|
666
|
-
cx: number;
|
|
667
|
-
cy: number;
|
|
668
|
-
rx: number;
|
|
669
|
-
ry: number;
|
|
670
|
-
} | {
|
|
671
|
-
op: 'Arc';
|
|
672
|
-
cx: number;
|
|
673
|
-
cy: number;
|
|
674
|
-
r: number;
|
|
675
|
-
start_angle: number;
|
|
676
|
-
end_angle: number;
|
|
677
|
-
counterclockwise: boolean;
|
|
678
|
-
} | {
|
|
679
|
-
op: 'Stroke';
|
|
680
|
-
} | {
|
|
681
|
-
op: 'Fill';
|
|
682
|
-
} | {
|
|
683
|
-
op: 'FillAndStroke';
|
|
684
|
-
} | {
|
|
685
|
-
op: 'SetFillColor';
|
|
686
|
-
r: number;
|
|
687
|
-
g: number;
|
|
688
|
-
b: number;
|
|
689
|
-
} | {
|
|
690
|
-
op: 'SetStrokeColor';
|
|
691
|
-
r: number;
|
|
692
|
-
g: number;
|
|
693
|
-
b: number;
|
|
694
|
-
} | {
|
|
695
|
-
op: 'SetLineWidth';
|
|
696
|
-
width: number;
|
|
697
|
-
} | {
|
|
698
|
-
op: 'SetLineCap';
|
|
699
|
-
cap: number;
|
|
700
|
-
} | {
|
|
701
|
-
op: 'SetLineJoin';
|
|
702
|
-
join: number;
|
|
703
|
-
} | {
|
|
704
|
-
op: 'Save';
|
|
705
|
-
} | {
|
|
706
|
-
op: 'Restore';
|
|
707
|
-
};
|
|
708
281
|
export interface CanvasProps {
|
|
709
282
|
width: number;
|
|
710
283
|
height: number;
|
|
711
284
|
draw: (ctx: CanvasContext) => void;
|
|
712
285
|
style?: Style;
|
|
713
286
|
}
|
|
714
|
-
/** A styled text segment within a <Text> element */
|
|
715
|
-
export interface TextRun {
|
|
716
|
-
content: string;
|
|
717
|
-
style?: FormeStyle;
|
|
718
|
-
href?: string;
|
|
719
|
-
}
|
|
720
|
-
export interface FormeFont {
|
|
721
|
-
family: string;
|
|
722
|
-
src: string | Uint8Array;
|
|
723
|
-
weight: number;
|
|
724
|
-
italic: boolean;
|
|
725
|
-
}
|
|
726
|
-
export interface FormeDocument {
|
|
727
|
-
children: FormeNode[];
|
|
728
|
-
metadata: FormeMetadata;
|
|
729
|
-
defaultPage: FormePageConfig;
|
|
730
|
-
defaultStyle?: FormeStyle;
|
|
731
|
-
fonts?: FormeFont[];
|
|
732
|
-
tagged?: boolean;
|
|
733
|
-
pdfa?: '2a' | '2b';
|
|
734
|
-
pdfUa?: boolean;
|
|
735
|
-
flattenForms?: boolean;
|
|
736
|
-
certification?: CertificationConfig;
|
|
737
|
-
}
|
|
738
|
-
export interface FormeMetadata {
|
|
739
|
-
title?: string;
|
|
740
|
-
author?: string;
|
|
741
|
-
subject?: string;
|
|
742
|
-
creator?: string;
|
|
743
|
-
lang?: string;
|
|
744
|
-
}
|
|
745
|
-
export interface FormePageConfig {
|
|
746
|
-
size: FormePageSize;
|
|
747
|
-
margin: FormeEdges;
|
|
748
|
-
wrap: boolean;
|
|
749
|
-
backgroundImage?: string;
|
|
750
|
-
backgroundOpacity?: number;
|
|
751
|
-
backgroundSize?: 'fill' | 'cover' | 'contain';
|
|
752
|
-
backgroundPosition?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
753
|
-
}
|
|
754
|
-
export type FormePageSize = 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'Tabloid' | {
|
|
755
|
-
Custom: {
|
|
756
|
-
width: number;
|
|
757
|
-
height: number;
|
|
758
|
-
};
|
|
759
|
-
};
|
|
760
|
-
export interface FormeEdges {
|
|
761
|
-
top: number;
|
|
762
|
-
right: number;
|
|
763
|
-
bottom: number;
|
|
764
|
-
left: number;
|
|
765
|
-
}
|
|
766
|
-
export interface FormeBoxShadow {
|
|
767
|
-
offsetX: number;
|
|
768
|
-
offsetY: number;
|
|
769
|
-
blur?: number;
|
|
770
|
-
color: {
|
|
771
|
-
r: number;
|
|
772
|
-
g: number;
|
|
773
|
-
b: number;
|
|
774
|
-
a: number;
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
/** Engine wire format for list marker type — matches the Rust enum's
|
|
778
|
-
* serde camelCase output. */
|
|
779
|
-
export type FormeListMarkerType = 'disc' | 'circle' | 'square' | 'none' | 'decimal' | 'lowerAlpha' | 'upperAlpha' | 'lowerRoman' | 'upperRoman';
|
|
780
|
-
/** A single transform operation in the engine wire format. The discriminator
|
|
781
|
-
* is `type` matching the engine's serde tag. */
|
|
782
|
-
export type FormeTransformOp = {
|
|
783
|
-
type: 'rotate';
|
|
784
|
-
deg: number;
|
|
785
|
-
} | {
|
|
786
|
-
type: 'scale';
|
|
787
|
-
x: number;
|
|
788
|
-
y: number;
|
|
789
|
-
} | {
|
|
790
|
-
type: 'translate';
|
|
791
|
-
x: number;
|
|
792
|
-
y: number;
|
|
793
|
-
};
|
|
794
|
-
export interface FormeGradientStop {
|
|
795
|
-
position: number;
|
|
796
|
-
color: {
|
|
797
|
-
r: number;
|
|
798
|
-
g: number;
|
|
799
|
-
b: number;
|
|
800
|
-
a: number;
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
export type FormeBackground = {
|
|
804
|
-
type: 'color';
|
|
805
|
-
value: {
|
|
806
|
-
r: number;
|
|
807
|
-
g: number;
|
|
808
|
-
b: number;
|
|
809
|
-
a: number;
|
|
810
|
-
};
|
|
811
|
-
} | {
|
|
812
|
-
type: 'linear';
|
|
813
|
-
angleDeg: number;
|
|
814
|
-
stops: FormeGradientStop[];
|
|
815
|
-
} | {
|
|
816
|
-
type: 'radial';
|
|
817
|
-
stops: FormeGradientStop[];
|
|
818
|
-
};
|
|
819
|
-
/** Margin edges that support auto values (for centering). */
|
|
820
|
-
export interface FormeMarginEdges {
|
|
821
|
-
top: number | 'auto';
|
|
822
|
-
right: number | 'auto';
|
|
823
|
-
bottom: number | 'auto';
|
|
824
|
-
left: number | 'auto';
|
|
825
|
-
}
|
|
826
|
-
export interface FormeNode {
|
|
827
|
-
kind: FormeNodeKind;
|
|
828
|
-
style: FormeStyle;
|
|
829
|
-
children: FormeNode[];
|
|
830
|
-
bookmark?: string;
|
|
831
|
-
href?: string;
|
|
832
|
-
alt?: string;
|
|
833
|
-
sourceLocation?: {
|
|
834
|
-
file: string;
|
|
835
|
-
line: number;
|
|
836
|
-
column: number;
|
|
837
|
-
};
|
|
838
|
-
}
|
|
839
|
-
export type FormeNodeKind = {
|
|
840
|
-
type: 'Page';
|
|
841
|
-
config: FormePageConfig;
|
|
842
|
-
} | {
|
|
843
|
-
type: 'View';
|
|
844
|
-
} | {
|
|
845
|
-
type: 'Text';
|
|
846
|
-
content: string;
|
|
847
|
-
href?: string;
|
|
848
|
-
runs?: TextRun[];
|
|
849
|
-
} | {
|
|
850
|
-
type: 'Heading';
|
|
851
|
-
level: number;
|
|
852
|
-
content: string;
|
|
853
|
-
href?: string;
|
|
854
|
-
runs?: TextRun[];
|
|
855
|
-
} | {
|
|
856
|
-
type: 'List';
|
|
857
|
-
ordered: boolean;
|
|
858
|
-
marker_type: FormeListMarkerType;
|
|
859
|
-
start: number;
|
|
860
|
-
} | {
|
|
861
|
-
type: 'ListItem';
|
|
862
|
-
} | {
|
|
863
|
-
type: 'Image';
|
|
864
|
-
src: string;
|
|
865
|
-
width?: number;
|
|
866
|
-
height?: number;
|
|
867
|
-
} | {
|
|
868
|
-
type: 'Table';
|
|
869
|
-
columns: FormeColumnDef[];
|
|
870
|
-
} | {
|
|
871
|
-
type: 'TableRow';
|
|
872
|
-
is_header: boolean;
|
|
873
|
-
} | {
|
|
874
|
-
type: 'TableCell';
|
|
875
|
-
col_span: number;
|
|
876
|
-
row_span: number;
|
|
877
|
-
} | {
|
|
878
|
-
type: 'Fixed';
|
|
879
|
-
position: 'Header' | 'Footer';
|
|
880
|
-
} | {
|
|
881
|
-
type: 'Svg';
|
|
882
|
-
width: number;
|
|
883
|
-
height: number;
|
|
884
|
-
view_box?: string;
|
|
885
|
-
content: string;
|
|
886
|
-
} | {
|
|
887
|
-
type: 'QrCode';
|
|
888
|
-
data: string;
|
|
889
|
-
size?: number;
|
|
890
|
-
} | {
|
|
891
|
-
type: 'Barcode';
|
|
892
|
-
data: string;
|
|
893
|
-
format: BarcodeFormat;
|
|
894
|
-
width?: number;
|
|
895
|
-
height: number;
|
|
896
|
-
} | {
|
|
897
|
-
type: 'Canvas';
|
|
898
|
-
width: number;
|
|
899
|
-
height: number;
|
|
900
|
-
operations: CanvasOp[];
|
|
901
|
-
} | {
|
|
902
|
-
type: 'BarChart';
|
|
903
|
-
data: ChartDataPoint[];
|
|
904
|
-
width: number;
|
|
905
|
-
height: number;
|
|
906
|
-
color?: string;
|
|
907
|
-
show_labels: boolean;
|
|
908
|
-
show_values: boolean;
|
|
909
|
-
show_grid: boolean;
|
|
910
|
-
title?: string;
|
|
911
|
-
} | {
|
|
912
|
-
type: 'LineChart';
|
|
913
|
-
series: ChartSeries[];
|
|
914
|
-
labels: string[];
|
|
915
|
-
width: number;
|
|
916
|
-
height: number;
|
|
917
|
-
show_points: boolean;
|
|
918
|
-
show_grid: boolean;
|
|
919
|
-
title?: string;
|
|
920
|
-
} | {
|
|
921
|
-
type: 'PieChart';
|
|
922
|
-
data: ChartDataPoint[];
|
|
923
|
-
width: number;
|
|
924
|
-
height: number;
|
|
925
|
-
donut: boolean;
|
|
926
|
-
show_legend: boolean;
|
|
927
|
-
title?: string;
|
|
928
|
-
} | {
|
|
929
|
-
type: 'AreaChart';
|
|
930
|
-
series: ChartSeries[];
|
|
931
|
-
labels: string[];
|
|
932
|
-
width: number;
|
|
933
|
-
height: number;
|
|
934
|
-
show_grid: boolean;
|
|
935
|
-
title?: string;
|
|
936
|
-
} | {
|
|
937
|
-
type: 'DotPlot';
|
|
938
|
-
groups: DotPlotGroup[];
|
|
939
|
-
width: number;
|
|
940
|
-
height: number;
|
|
941
|
-
x_min?: number;
|
|
942
|
-
x_max?: number;
|
|
943
|
-
y_min?: number;
|
|
944
|
-
y_max?: number;
|
|
945
|
-
x_label?: string;
|
|
946
|
-
y_label?: string;
|
|
947
|
-
show_legend: boolean;
|
|
948
|
-
dot_size: number;
|
|
949
|
-
} | {
|
|
950
|
-
type: 'Watermark';
|
|
951
|
-
text: string;
|
|
952
|
-
font_size: number;
|
|
953
|
-
angle: number;
|
|
954
|
-
} | {
|
|
955
|
-
type: 'TextField';
|
|
956
|
-
name: string;
|
|
957
|
-
width: number;
|
|
958
|
-
height: number;
|
|
959
|
-
value?: string;
|
|
960
|
-
placeholder?: string;
|
|
961
|
-
multiline: boolean;
|
|
962
|
-
password: boolean;
|
|
963
|
-
read_only: boolean;
|
|
964
|
-
max_length?: number;
|
|
965
|
-
font_size: number;
|
|
966
|
-
} | {
|
|
967
|
-
type: 'Checkbox';
|
|
968
|
-
name: string;
|
|
969
|
-
width: number;
|
|
970
|
-
height: number;
|
|
971
|
-
checked: boolean;
|
|
972
|
-
read_only: boolean;
|
|
973
|
-
} | {
|
|
974
|
-
type: 'Dropdown';
|
|
975
|
-
name: string;
|
|
976
|
-
options: string[];
|
|
977
|
-
width: number;
|
|
978
|
-
height: number;
|
|
979
|
-
value?: string;
|
|
980
|
-
read_only: boolean;
|
|
981
|
-
font_size: number;
|
|
982
|
-
} | {
|
|
983
|
-
type: 'RadioButton';
|
|
984
|
-
name: string;
|
|
985
|
-
value: string;
|
|
986
|
-
width: number;
|
|
987
|
-
height: number;
|
|
988
|
-
checked: boolean;
|
|
989
|
-
read_only: boolean;
|
|
990
|
-
} | {
|
|
991
|
-
type: 'PageBreak';
|
|
992
|
-
};
|
|
993
|
-
export interface FormeColumnDef {
|
|
994
|
-
width: FormeColumnWidth;
|
|
995
|
-
}
|
|
996
|
-
export type FormeColumnWidth = {
|
|
997
|
-
Fraction: number;
|
|
998
|
-
} | {
|
|
999
|
-
Fixed: number;
|
|
1000
|
-
} | 'Auto';
|
|
1001
|
-
export type FormeDimension = {
|
|
1002
|
-
Pt: number;
|
|
1003
|
-
} | {
|
|
1004
|
-
Percent: number;
|
|
1005
|
-
} | 'Auto';
|
|
1006
|
-
export interface FormeColor {
|
|
1007
|
-
r: number;
|
|
1008
|
-
g: number;
|
|
1009
|
-
b: number;
|
|
1010
|
-
a: number;
|
|
1011
|
-
}
|
|
1012
|
-
export interface FormeEdgeValues<T> {
|
|
1013
|
-
top: T;
|
|
1014
|
-
right: T;
|
|
1015
|
-
bottom: T;
|
|
1016
|
-
left: T;
|
|
1017
|
-
}
|
|
1018
|
-
export interface FormeCornerValues {
|
|
1019
|
-
top_left: number;
|
|
1020
|
-
top_right: number;
|
|
1021
|
-
bottom_right: number;
|
|
1022
|
-
bottom_left: number;
|
|
1023
|
-
}
|
|
1024
|
-
/** Grid track size in Forme JSON format (matches Rust GridTrackSize enum) */
|
|
1025
|
-
export type FormeGridTrackSize = {
|
|
1026
|
-
Pt: number;
|
|
1027
|
-
} | {
|
|
1028
|
-
Fr: number;
|
|
1029
|
-
} | 'Auto' | {
|
|
1030
|
-
MinMax: [FormeGridTrackSize, FormeGridTrackSize];
|
|
1031
|
-
};
|
|
1032
|
-
/** Grid placement in Forme JSON format */
|
|
1033
|
-
export interface FormeGridPlacement {
|
|
1034
|
-
columnStart?: number;
|
|
1035
|
-
columnEnd?: number;
|
|
1036
|
-
rowStart?: number;
|
|
1037
|
-
rowEnd?: number;
|
|
1038
|
-
columnSpan?: number;
|
|
1039
|
-
rowSpan?: number;
|
|
1040
|
-
}
|
|
1041
|
-
/** Style in the Forme JSON format (camelCase field names, PascalCase enum values) */
|
|
1042
|
-
export interface FormeStyle {
|
|
1043
|
-
display?: string;
|
|
1044
|
-
width?: FormeDimension;
|
|
1045
|
-
height?: FormeDimension;
|
|
1046
|
-
minWidth?: FormeDimension;
|
|
1047
|
-
minHeight?: FormeDimension;
|
|
1048
|
-
maxWidth?: FormeDimension;
|
|
1049
|
-
maxHeight?: FormeDimension;
|
|
1050
|
-
padding?: FormeEdges;
|
|
1051
|
-
margin?: FormeMarginEdges;
|
|
1052
|
-
flexDirection?: string;
|
|
1053
|
-
justifyContent?: string;
|
|
1054
|
-
alignItems?: string;
|
|
1055
|
-
alignSelf?: string;
|
|
1056
|
-
alignContent?: string;
|
|
1057
|
-
flexWrap?: string;
|
|
1058
|
-
flexGrow?: number;
|
|
1059
|
-
flexShrink?: number;
|
|
1060
|
-
flexBasis?: FormeDimension;
|
|
1061
|
-
gap?: number;
|
|
1062
|
-
rowGap?: number;
|
|
1063
|
-
columnGap?: number;
|
|
1064
|
-
gridTemplateColumns?: FormeGridTrackSize[];
|
|
1065
|
-
gridTemplateRows?: FormeGridTrackSize[];
|
|
1066
|
-
gridAutoRows?: FormeGridTrackSize;
|
|
1067
|
-
gridAutoColumns?: FormeGridTrackSize;
|
|
1068
|
-
gridPlacement?: FormeGridPlacement;
|
|
1069
|
-
fontFamily?: string;
|
|
1070
|
-
fontSize?: number;
|
|
1071
|
-
fontWeight?: number;
|
|
1072
|
-
fontStyle?: string;
|
|
1073
|
-
lineHeight?: number;
|
|
1074
|
-
textAlign?: string;
|
|
1075
|
-
letterSpacing?: number;
|
|
1076
|
-
wordSpacing?: number;
|
|
1077
|
-
boxShadow?: FormeBoxShadow;
|
|
1078
|
-
transform?: FormeTransformOp[];
|
|
1079
|
-
transformOrigin?: [number, number];
|
|
1080
|
-
textDecoration?: string;
|
|
1081
|
-
textTransform?: string;
|
|
1082
|
-
hyphens?: string;
|
|
1083
|
-
lang?: string;
|
|
1084
|
-
direction?: string;
|
|
1085
|
-
textOverflow?: string;
|
|
1086
|
-
lineBreaking?: string;
|
|
1087
|
-
overflow?: string;
|
|
1088
|
-
color?: FormeColor;
|
|
1089
|
-
backgroundColor?: FormeColor;
|
|
1090
|
-
background?: FormeBackground;
|
|
1091
|
-
opacity?: number;
|
|
1092
|
-
borderWidth?: FormeEdgeValues<number>;
|
|
1093
|
-
borderColor?: FormeEdgeValues<FormeColor>;
|
|
1094
|
-
borderRadius?: FormeCornerValues;
|
|
1095
|
-
position?: string;
|
|
1096
|
-
top?: number;
|
|
1097
|
-
right?: number;
|
|
1098
|
-
bottom?: number;
|
|
1099
|
-
left?: number;
|
|
1100
|
-
wrap?: boolean;
|
|
1101
|
-
breakBefore?: boolean;
|
|
1102
|
-
minWidowLines?: number;
|
|
1103
|
-
minOrphanLines?: number;
|
|
1104
|
-
}
|