@formepdf/react 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.ts +131 -1
- package/dist/components.js +156 -0
- package/dist/font.d.ts +2 -11
- package/dist/font.js +1 -23
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/serialize.d.ts +1 -6
- package/dist/serialize.js +175 -991
- package/dist/types.d.ts +79 -766
- package/package.json +4 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,194 +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
|
-
borderWidth?: number | Edges;
|
|
134
|
-
borderTopWidth?: number;
|
|
135
|
-
borderRightWidth?: number;
|
|
136
|
-
borderBottomWidth?: number;
|
|
137
|
-
borderLeftWidth?: number;
|
|
138
|
-
borderColor?: string | EdgeColors;
|
|
139
|
-
borderTopColor?: string;
|
|
140
|
-
borderRightColor?: string;
|
|
141
|
-
borderBottomColor?: string;
|
|
142
|
-
borderLeftColor?: string;
|
|
143
|
-
borderRadius?: number | Corners;
|
|
144
|
-
borderTopLeftRadius?: number;
|
|
145
|
-
borderTopRightRadius?: number;
|
|
146
|
-
borderBottomRightRadius?: number;
|
|
147
|
-
borderBottomLeftRadius?: number;
|
|
148
|
-
/** CSS border shorthand, e.g. `"1px solid #000"` */
|
|
149
|
-
border?: string;
|
|
150
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
151
|
-
borderTop?: string | number;
|
|
152
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
153
|
-
borderRight?: string | number;
|
|
154
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
155
|
-
borderBottom?: string | number;
|
|
156
|
-
/** Per-side border shorthand: string parses as CSS, number sets width */
|
|
157
|
-
borderLeft?: string | number;
|
|
158
|
-
position?: 'relative' | 'absolute';
|
|
159
|
-
top?: number;
|
|
160
|
-
right?: number;
|
|
161
|
-
bottom?: number;
|
|
162
|
-
left?: number;
|
|
163
|
-
wrap?: boolean;
|
|
164
|
-
breakBefore?: boolean;
|
|
165
|
-
minWidowLines?: number;
|
|
166
|
-
minOrphanLines?: number;
|
|
167
|
-
}
|
|
168
|
-
export interface CertificationConfig {
|
|
169
|
-
/** PEM-encoded X.509 certificate. */
|
|
170
|
-
certificatePem: string;
|
|
171
|
-
/** PEM-encoded RSA private key (PKCS#8). */
|
|
172
|
-
privateKeyPem: string;
|
|
173
|
-
/** Reason for certification (e.g. "Approved"). */
|
|
174
|
-
reason?: string;
|
|
175
|
-
/** Location of certification (e.g. "New York, NY"). */
|
|
176
|
-
location?: string;
|
|
177
|
-
/** Contact info for the certifier. */
|
|
178
|
-
contact?: string;
|
|
179
|
-
/** Whether to show a visible signature annotation on the page. */
|
|
180
|
-
visible?: boolean;
|
|
181
|
-
/** X coordinate in points for visible signature. */
|
|
182
|
-
x?: number;
|
|
183
|
-
/** Y coordinate in points for visible signature. */
|
|
184
|
-
y?: number;
|
|
185
|
-
/** Width in points for visible signature. */
|
|
186
|
-
width?: number;
|
|
187
|
-
/** Height in points for visible signature. */
|
|
188
|
-
height?: number;
|
|
189
|
-
}
|
|
190
|
-
/** @deprecated Use CertificationConfig */
|
|
191
|
-
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';
|
|
192
5
|
export interface DocumentProps {
|
|
193
6
|
title?: string;
|
|
194
7
|
author?: string;
|
|
@@ -217,6 +30,8 @@ export interface PageProps {
|
|
|
217
30
|
height: number;
|
|
218
31
|
};
|
|
219
32
|
margin?: number | string | number[] | Edges;
|
|
33
|
+
/** Style applied to the page's content area (background, padding, default text styles). */
|
|
34
|
+
style?: Style;
|
|
220
35
|
/** Optional background image painted behind the page's content. URL,
|
|
221
36
|
* file path, or `data:image/...;base64,` URI. */
|
|
222
37
|
backgroundImage?: string;
|
|
@@ -241,6 +56,81 @@ export interface TextProps {
|
|
|
241
56
|
bookmark?: string;
|
|
242
57
|
children?: ReactNode;
|
|
243
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* An ordered (numbered) list. Children must be `<ListItem>`s.
|
|
61
|
+
*/
|
|
62
|
+
export interface OrderedListProps {
|
|
63
|
+
/** Marker style. Defaults to `'decimal'`. */
|
|
64
|
+
type?: 'decimal' | 'lower-alpha' | 'upper-alpha' | 'lower-roman' | 'upper-roman';
|
|
65
|
+
/** Starting index. Defaults to `1`. */
|
|
66
|
+
start?: number;
|
|
67
|
+
style?: Style;
|
|
68
|
+
bookmark?: string;
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* An unordered (bulleted) list. Children must be `<ListItem>`s.
|
|
73
|
+
*/
|
|
74
|
+
export interface UnorderedListProps {
|
|
75
|
+
/** Bullet glyph style. Defaults to `'disc'`. */
|
|
76
|
+
marker?: 'disc' | 'circle' | 'square' | 'none';
|
|
77
|
+
style?: Style;
|
|
78
|
+
bookmark?: string;
|
|
79
|
+
children?: ReactNode;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* One item inside an `<OrderedList>` or `<UnorderedList>`. Content can be
|
|
83
|
+
* text, inline-formatted runs, nested lists, or any other Forme node.
|
|
84
|
+
*/
|
|
85
|
+
export interface ListItemProps {
|
|
86
|
+
style?: Style;
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Semantic heading. Renders text with sensible default styling per level
|
|
91
|
+
* (size, weight, margin) AND tags the element as `/H1`–`/H6` in tagged
|
|
92
|
+
* PDFs (PDF/UA / PDF/A-2a), so screen readers and the PDF outline
|
|
93
|
+
* builder treat it as a heading. Inline formatting components like
|
|
94
|
+
* `<Strong>` and `<Em>` work inside.
|
|
95
|
+
*/
|
|
96
|
+
export interface HeadingProps {
|
|
97
|
+
style?: Style;
|
|
98
|
+
href?: string;
|
|
99
|
+
bookmark?: string;
|
|
100
|
+
children?: ReactNode;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Inline bold text. Only meaningful as a child of `<Text>` — produces a
|
|
104
|
+
* TextRun with `fontWeight: 700` merged with any provided `style`.
|
|
105
|
+
*/
|
|
106
|
+
export interface StrongProps {
|
|
107
|
+
style?: Style;
|
|
108
|
+
children?: ReactNode;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Inline italic text. Only meaningful as a child of `<Text>`.
|
|
112
|
+
*/
|
|
113
|
+
export interface EmProps {
|
|
114
|
+
style?: Style;
|
|
115
|
+
children?: ReactNode;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Inline monospace text with a subtle background. Only meaningful as a
|
|
119
|
+
* child of `<Text>`.
|
|
120
|
+
*/
|
|
121
|
+
export interface CodeProps {
|
|
122
|
+
style?: Style;
|
|
123
|
+
children?: ReactNode;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Inline hyperlink. Renders blue + underlined; clickable in the rendered
|
|
127
|
+
* PDF. Only meaningful as a child of `<Text>`.
|
|
128
|
+
*/
|
|
129
|
+
export interface LinkProps {
|
|
130
|
+
href: string;
|
|
131
|
+
style?: Style;
|
|
132
|
+
children?: ReactNode;
|
|
133
|
+
}
|
|
244
134
|
export interface ImageProps {
|
|
245
135
|
src: string;
|
|
246
136
|
width?: number;
|
|
@@ -251,13 +141,6 @@ export interface ImageProps {
|
|
|
251
141
|
/** Alt text for accessibility. */
|
|
252
142
|
alt?: string;
|
|
253
143
|
}
|
|
254
|
-
export interface ColumnDef {
|
|
255
|
-
width: {
|
|
256
|
-
fraction: number;
|
|
257
|
-
} | {
|
|
258
|
-
fixed: number;
|
|
259
|
-
} | 'auto';
|
|
260
|
-
}
|
|
261
144
|
export interface TableProps {
|
|
262
145
|
columns?: ColumnDef[];
|
|
263
146
|
style?: Style;
|
|
@@ -303,7 +186,6 @@ export interface QrCodeProps {
|
|
|
303
186
|
color?: string;
|
|
304
187
|
style?: Style;
|
|
305
188
|
}
|
|
306
|
-
export type BarcodeFormat = 'Code128' | 'Code39' | 'EAN13' | 'EAN8' | 'Codabar';
|
|
307
189
|
export interface BarcodeProps {
|
|
308
190
|
/** The data to encode. */
|
|
309
191
|
data: string;
|
|
@@ -317,112 +199,6 @@ export interface BarcodeProps {
|
|
|
317
199
|
color?: string;
|
|
318
200
|
style?: Style;
|
|
319
201
|
}
|
|
320
|
-
/** Data point for bar and pie charts. */
|
|
321
|
-
export interface ChartDataPoint {
|
|
322
|
-
label: string;
|
|
323
|
-
value: number;
|
|
324
|
-
/** Optional per-item color (hex string). */
|
|
325
|
-
color?: string;
|
|
326
|
-
}
|
|
327
|
-
/** @deprecated Use ChartDataPoint instead (color is now optional on ChartDataPoint). */
|
|
328
|
-
export interface PieDataPoint {
|
|
329
|
-
label: string;
|
|
330
|
-
value: number;
|
|
331
|
-
color: string;
|
|
332
|
-
}
|
|
333
|
-
/** A data series for multi-series line and area charts. */
|
|
334
|
-
export interface ChartSeries {
|
|
335
|
-
name: string;
|
|
336
|
-
data: number[];
|
|
337
|
-
/** Optional series color (hex string). */
|
|
338
|
-
color?: string;
|
|
339
|
-
}
|
|
340
|
-
/** A group of (x, y) data points for dot plots. */
|
|
341
|
-
export interface DotPlotGroup {
|
|
342
|
-
name: string;
|
|
343
|
-
/** Optional group color (hex string). */
|
|
344
|
-
color?: string;
|
|
345
|
-
data: [number, number][];
|
|
346
|
-
}
|
|
347
|
-
export interface BarChartProps {
|
|
348
|
-
width: number;
|
|
349
|
-
height: number;
|
|
350
|
-
data: ChartDataPoint[];
|
|
351
|
-
/** Bar color. Default: "#1a365d". */
|
|
352
|
-
color?: string;
|
|
353
|
-
/** Show X-axis labels below bars. Default: true. */
|
|
354
|
-
showLabels?: boolean;
|
|
355
|
-
/** Show horizontal grid lines. Default: false. */
|
|
356
|
-
showGrid?: boolean;
|
|
357
|
-
/** Show value labels above bars. Default: false. */
|
|
358
|
-
showValues?: boolean;
|
|
359
|
-
/** Chart title. */
|
|
360
|
-
title?: string;
|
|
361
|
-
style?: Style;
|
|
362
|
-
}
|
|
363
|
-
export interface LineChartProps {
|
|
364
|
-
width: number;
|
|
365
|
-
height: number;
|
|
366
|
-
/** Multi-series data. */
|
|
367
|
-
series: ChartSeries[];
|
|
368
|
-
/** X-axis labels. */
|
|
369
|
-
labels: string[];
|
|
370
|
-
/** Show dots at data points. Default: false. */
|
|
371
|
-
showPoints?: boolean;
|
|
372
|
-
/** Show horizontal grid lines. Default: false. */
|
|
373
|
-
showGrid?: boolean;
|
|
374
|
-
/** Chart title. */
|
|
375
|
-
title?: string;
|
|
376
|
-
style?: Style;
|
|
377
|
-
}
|
|
378
|
-
export interface PieChartProps {
|
|
379
|
-
width: number;
|
|
380
|
-
height: number;
|
|
381
|
-
data: ChartDataPoint[];
|
|
382
|
-
/** Render as donut chart. Default: false. */
|
|
383
|
-
donut?: boolean;
|
|
384
|
-
/** Show legend. Default: false. */
|
|
385
|
-
showLegend?: boolean;
|
|
386
|
-
/** Chart title. */
|
|
387
|
-
title?: string;
|
|
388
|
-
style?: Style;
|
|
389
|
-
}
|
|
390
|
-
export interface AreaChartProps {
|
|
391
|
-
width: number;
|
|
392
|
-
height: number;
|
|
393
|
-
/** Multi-series data. */
|
|
394
|
-
series: ChartSeries[];
|
|
395
|
-
/** X-axis labels. */
|
|
396
|
-
labels: string[];
|
|
397
|
-
/** Show horizontal grid lines. Default: false. */
|
|
398
|
-
showGrid?: boolean;
|
|
399
|
-
/** Chart title. */
|
|
400
|
-
title?: string;
|
|
401
|
-
style?: Style;
|
|
402
|
-
}
|
|
403
|
-
export interface DotPlotProps {
|
|
404
|
-
width: number;
|
|
405
|
-
height: number;
|
|
406
|
-
/** Groups of (x, y) data points. */
|
|
407
|
-
groups: DotPlotGroup[];
|
|
408
|
-
/** Minimum X value. Auto-computed if omitted. */
|
|
409
|
-
xMin?: number;
|
|
410
|
-
/** Maximum X value. Auto-computed if omitted. */
|
|
411
|
-
xMax?: number;
|
|
412
|
-
/** Minimum Y value. Auto-computed if omitted. */
|
|
413
|
-
yMin?: number;
|
|
414
|
-
/** Maximum Y value. Auto-computed if omitted. */
|
|
415
|
-
yMax?: number;
|
|
416
|
-
/** X-axis label. */
|
|
417
|
-
xLabel?: string;
|
|
418
|
-
/** Y-axis label. */
|
|
419
|
-
yLabel?: string;
|
|
420
|
-
/** Show legend. Default: false. */
|
|
421
|
-
showLegend?: boolean;
|
|
422
|
-
/** Dot radius in points. Default: 4. */
|
|
423
|
-
dotSize?: number;
|
|
424
|
-
style?: Style;
|
|
425
|
-
}
|
|
426
202
|
export interface TextFieldProps {
|
|
427
203
|
/** Unique field name (used as the PDF field identifier). */
|
|
428
204
|
name: string;
|
|
@@ -502,472 +278,9 @@ export interface WatermarkProps {
|
|
|
502
278
|
angle?: number;
|
|
503
279
|
style?: Style;
|
|
504
280
|
}
|
|
505
|
-
/** Canvas drawing context for the draw callback. */
|
|
506
|
-
export interface CanvasContext {
|
|
507
|
-
moveTo(x: number, y: number): void;
|
|
508
|
-
lineTo(x: number, y: number): void;
|
|
509
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
510
|
-
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
|
|
511
|
-
closePath(): void;
|
|
512
|
-
rect(x: number, y: number, w: number, h: number): void;
|
|
513
|
-
circle(cx: number, cy: number, r: number): void;
|
|
514
|
-
ellipse(cx: number, cy: number, rx: number, ry: number): void;
|
|
515
|
-
arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
|
|
516
|
-
/** Convenience: draws a stroked line from (x1,y1) to (x2,y2). */
|
|
517
|
-
line(x1: number, y1: number, x2: number, y2: number): void;
|
|
518
|
-
stroke(): void;
|
|
519
|
-
fill(): void;
|
|
520
|
-
fillAndStroke(): void;
|
|
521
|
-
setFillColor(r: number, g: number, b: number): void;
|
|
522
|
-
setStrokeColor(r: number, g: number, b: number): void;
|
|
523
|
-
setLineWidth(w: number): void;
|
|
524
|
-
setLineCap(cap: number): void;
|
|
525
|
-
setLineJoin(join: number): void;
|
|
526
|
-
save(): void;
|
|
527
|
-
restore(): void;
|
|
528
|
-
}
|
|
529
|
-
/** A single canvas drawing operation (serialized to JSON). */
|
|
530
|
-
export type CanvasOp = {
|
|
531
|
-
op: 'MoveTo';
|
|
532
|
-
x: number;
|
|
533
|
-
y: number;
|
|
534
|
-
} | {
|
|
535
|
-
op: 'LineTo';
|
|
536
|
-
x: number;
|
|
537
|
-
y: number;
|
|
538
|
-
} | {
|
|
539
|
-
op: 'BezierCurveTo';
|
|
540
|
-
cp1x: number;
|
|
541
|
-
cp1y: number;
|
|
542
|
-
cp2x: number;
|
|
543
|
-
cp2y: number;
|
|
544
|
-
x: number;
|
|
545
|
-
y: number;
|
|
546
|
-
} | {
|
|
547
|
-
op: 'QuadraticCurveTo';
|
|
548
|
-
cpx: number;
|
|
549
|
-
cpy: number;
|
|
550
|
-
x: number;
|
|
551
|
-
y: number;
|
|
552
|
-
} | {
|
|
553
|
-
op: 'ClosePath';
|
|
554
|
-
} | {
|
|
555
|
-
op: 'Rect';
|
|
556
|
-
x: number;
|
|
557
|
-
y: number;
|
|
558
|
-
width: number;
|
|
559
|
-
height: number;
|
|
560
|
-
} | {
|
|
561
|
-
op: 'Circle';
|
|
562
|
-
cx: number;
|
|
563
|
-
cy: number;
|
|
564
|
-
r: number;
|
|
565
|
-
} | {
|
|
566
|
-
op: 'Ellipse';
|
|
567
|
-
cx: number;
|
|
568
|
-
cy: number;
|
|
569
|
-
rx: number;
|
|
570
|
-
ry: number;
|
|
571
|
-
} | {
|
|
572
|
-
op: 'Arc';
|
|
573
|
-
cx: number;
|
|
574
|
-
cy: number;
|
|
575
|
-
r: number;
|
|
576
|
-
start_angle: number;
|
|
577
|
-
end_angle: number;
|
|
578
|
-
counterclockwise: boolean;
|
|
579
|
-
} | {
|
|
580
|
-
op: 'Stroke';
|
|
581
|
-
} | {
|
|
582
|
-
op: 'Fill';
|
|
583
|
-
} | {
|
|
584
|
-
op: 'FillAndStroke';
|
|
585
|
-
} | {
|
|
586
|
-
op: 'SetFillColor';
|
|
587
|
-
r: number;
|
|
588
|
-
g: number;
|
|
589
|
-
b: number;
|
|
590
|
-
} | {
|
|
591
|
-
op: 'SetStrokeColor';
|
|
592
|
-
r: number;
|
|
593
|
-
g: number;
|
|
594
|
-
b: number;
|
|
595
|
-
} | {
|
|
596
|
-
op: 'SetLineWidth';
|
|
597
|
-
width: number;
|
|
598
|
-
} | {
|
|
599
|
-
op: 'SetLineCap';
|
|
600
|
-
cap: number;
|
|
601
|
-
} | {
|
|
602
|
-
op: 'SetLineJoin';
|
|
603
|
-
join: number;
|
|
604
|
-
} | {
|
|
605
|
-
op: 'Save';
|
|
606
|
-
} | {
|
|
607
|
-
op: 'Restore';
|
|
608
|
-
};
|
|
609
281
|
export interface CanvasProps {
|
|
610
282
|
width: number;
|
|
611
283
|
height: number;
|
|
612
284
|
draw: (ctx: CanvasContext) => void;
|
|
613
285
|
style?: Style;
|
|
614
286
|
}
|
|
615
|
-
/** A styled text segment within a <Text> element */
|
|
616
|
-
export interface TextRun {
|
|
617
|
-
content: string;
|
|
618
|
-
style?: FormeStyle;
|
|
619
|
-
href?: string;
|
|
620
|
-
}
|
|
621
|
-
export interface FormeFont {
|
|
622
|
-
family: string;
|
|
623
|
-
src: string | Uint8Array;
|
|
624
|
-
weight: number;
|
|
625
|
-
italic: boolean;
|
|
626
|
-
}
|
|
627
|
-
export interface FormeDocument {
|
|
628
|
-
children: FormeNode[];
|
|
629
|
-
metadata: FormeMetadata;
|
|
630
|
-
defaultPage: FormePageConfig;
|
|
631
|
-
defaultStyle?: FormeStyle;
|
|
632
|
-
fonts?: FormeFont[];
|
|
633
|
-
tagged?: boolean;
|
|
634
|
-
pdfa?: '2a' | '2b';
|
|
635
|
-
pdfUa?: boolean;
|
|
636
|
-
flattenForms?: boolean;
|
|
637
|
-
certification?: CertificationConfig;
|
|
638
|
-
}
|
|
639
|
-
export interface FormeMetadata {
|
|
640
|
-
title?: string;
|
|
641
|
-
author?: string;
|
|
642
|
-
subject?: string;
|
|
643
|
-
creator?: string;
|
|
644
|
-
lang?: string;
|
|
645
|
-
}
|
|
646
|
-
export interface FormePageConfig {
|
|
647
|
-
size: FormePageSize;
|
|
648
|
-
margin: FormeEdges;
|
|
649
|
-
wrap: boolean;
|
|
650
|
-
backgroundImage?: string;
|
|
651
|
-
backgroundOpacity?: number;
|
|
652
|
-
backgroundSize?: 'fill' | 'cover' | 'contain';
|
|
653
|
-
backgroundPosition?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
654
|
-
}
|
|
655
|
-
export type FormePageSize = 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'Tabloid' | {
|
|
656
|
-
Custom: {
|
|
657
|
-
width: number;
|
|
658
|
-
height: number;
|
|
659
|
-
};
|
|
660
|
-
};
|
|
661
|
-
export interface FormeEdges {
|
|
662
|
-
top: number;
|
|
663
|
-
right: number;
|
|
664
|
-
bottom: number;
|
|
665
|
-
left: number;
|
|
666
|
-
}
|
|
667
|
-
export interface FormeBoxShadow {
|
|
668
|
-
offsetX: number;
|
|
669
|
-
offsetY: number;
|
|
670
|
-
blur?: number;
|
|
671
|
-
color: {
|
|
672
|
-
r: number;
|
|
673
|
-
g: number;
|
|
674
|
-
b: number;
|
|
675
|
-
a: number;
|
|
676
|
-
};
|
|
677
|
-
}
|
|
678
|
-
export interface FormeGradientStop {
|
|
679
|
-
position: number;
|
|
680
|
-
color: {
|
|
681
|
-
r: number;
|
|
682
|
-
g: number;
|
|
683
|
-
b: number;
|
|
684
|
-
a: number;
|
|
685
|
-
};
|
|
686
|
-
}
|
|
687
|
-
export type FormeBackground = {
|
|
688
|
-
type: 'color';
|
|
689
|
-
value: {
|
|
690
|
-
r: number;
|
|
691
|
-
g: number;
|
|
692
|
-
b: number;
|
|
693
|
-
a: number;
|
|
694
|
-
};
|
|
695
|
-
} | {
|
|
696
|
-
type: 'linear';
|
|
697
|
-
angleDeg: number;
|
|
698
|
-
stops: FormeGradientStop[];
|
|
699
|
-
} | {
|
|
700
|
-
type: 'radial';
|
|
701
|
-
stops: FormeGradientStop[];
|
|
702
|
-
};
|
|
703
|
-
/** Margin edges that support auto values (for centering). */
|
|
704
|
-
export interface FormeMarginEdges {
|
|
705
|
-
top: number | 'auto';
|
|
706
|
-
right: number | 'auto';
|
|
707
|
-
bottom: number | 'auto';
|
|
708
|
-
left: number | 'auto';
|
|
709
|
-
}
|
|
710
|
-
export interface FormeNode {
|
|
711
|
-
kind: FormeNodeKind;
|
|
712
|
-
style: FormeStyle;
|
|
713
|
-
children: FormeNode[];
|
|
714
|
-
bookmark?: string;
|
|
715
|
-
href?: string;
|
|
716
|
-
alt?: string;
|
|
717
|
-
sourceLocation?: {
|
|
718
|
-
file: string;
|
|
719
|
-
line: number;
|
|
720
|
-
column: number;
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
export type FormeNodeKind = {
|
|
724
|
-
type: 'Page';
|
|
725
|
-
config: FormePageConfig;
|
|
726
|
-
} | {
|
|
727
|
-
type: 'View';
|
|
728
|
-
} | {
|
|
729
|
-
type: 'Text';
|
|
730
|
-
content: string;
|
|
731
|
-
href?: string;
|
|
732
|
-
runs?: TextRun[];
|
|
733
|
-
} | {
|
|
734
|
-
type: 'Image';
|
|
735
|
-
src: string;
|
|
736
|
-
width?: number;
|
|
737
|
-
height?: number;
|
|
738
|
-
} | {
|
|
739
|
-
type: 'Table';
|
|
740
|
-
columns: FormeColumnDef[];
|
|
741
|
-
} | {
|
|
742
|
-
type: 'TableRow';
|
|
743
|
-
is_header: boolean;
|
|
744
|
-
} | {
|
|
745
|
-
type: 'TableCell';
|
|
746
|
-
col_span: number;
|
|
747
|
-
row_span: number;
|
|
748
|
-
} | {
|
|
749
|
-
type: 'Fixed';
|
|
750
|
-
position: 'Header' | 'Footer';
|
|
751
|
-
} | {
|
|
752
|
-
type: 'Svg';
|
|
753
|
-
width: number;
|
|
754
|
-
height: number;
|
|
755
|
-
view_box?: string;
|
|
756
|
-
content: string;
|
|
757
|
-
} | {
|
|
758
|
-
type: 'QrCode';
|
|
759
|
-
data: string;
|
|
760
|
-
size?: number;
|
|
761
|
-
} | {
|
|
762
|
-
type: 'Barcode';
|
|
763
|
-
data: string;
|
|
764
|
-
format: BarcodeFormat;
|
|
765
|
-
width?: number;
|
|
766
|
-
height: number;
|
|
767
|
-
} | {
|
|
768
|
-
type: 'Canvas';
|
|
769
|
-
width: number;
|
|
770
|
-
height: number;
|
|
771
|
-
operations: CanvasOp[];
|
|
772
|
-
} | {
|
|
773
|
-
type: 'BarChart';
|
|
774
|
-
data: ChartDataPoint[];
|
|
775
|
-
width: number;
|
|
776
|
-
height: number;
|
|
777
|
-
color?: string;
|
|
778
|
-
show_labels: boolean;
|
|
779
|
-
show_values: boolean;
|
|
780
|
-
show_grid: boolean;
|
|
781
|
-
title?: string;
|
|
782
|
-
} | {
|
|
783
|
-
type: 'LineChart';
|
|
784
|
-
series: ChartSeries[];
|
|
785
|
-
labels: string[];
|
|
786
|
-
width: number;
|
|
787
|
-
height: number;
|
|
788
|
-
show_points: boolean;
|
|
789
|
-
show_grid: boolean;
|
|
790
|
-
title?: string;
|
|
791
|
-
} | {
|
|
792
|
-
type: 'PieChart';
|
|
793
|
-
data: ChartDataPoint[];
|
|
794
|
-
width: number;
|
|
795
|
-
height: number;
|
|
796
|
-
donut: boolean;
|
|
797
|
-
show_legend: boolean;
|
|
798
|
-
title?: string;
|
|
799
|
-
} | {
|
|
800
|
-
type: 'AreaChart';
|
|
801
|
-
series: ChartSeries[];
|
|
802
|
-
labels: string[];
|
|
803
|
-
width: number;
|
|
804
|
-
height: number;
|
|
805
|
-
show_grid: boolean;
|
|
806
|
-
title?: string;
|
|
807
|
-
} | {
|
|
808
|
-
type: 'DotPlot';
|
|
809
|
-
groups: DotPlotGroup[];
|
|
810
|
-
width: number;
|
|
811
|
-
height: number;
|
|
812
|
-
x_min?: number;
|
|
813
|
-
x_max?: number;
|
|
814
|
-
y_min?: number;
|
|
815
|
-
y_max?: number;
|
|
816
|
-
x_label?: string;
|
|
817
|
-
y_label?: string;
|
|
818
|
-
show_legend: boolean;
|
|
819
|
-
dot_size: number;
|
|
820
|
-
} | {
|
|
821
|
-
type: 'Watermark';
|
|
822
|
-
text: string;
|
|
823
|
-
font_size: number;
|
|
824
|
-
angle: number;
|
|
825
|
-
} | {
|
|
826
|
-
type: 'TextField';
|
|
827
|
-
name: string;
|
|
828
|
-
width: number;
|
|
829
|
-
height: number;
|
|
830
|
-
value?: string;
|
|
831
|
-
placeholder?: string;
|
|
832
|
-
multiline: boolean;
|
|
833
|
-
password: boolean;
|
|
834
|
-
read_only: boolean;
|
|
835
|
-
max_length?: number;
|
|
836
|
-
font_size: number;
|
|
837
|
-
} | {
|
|
838
|
-
type: 'Checkbox';
|
|
839
|
-
name: string;
|
|
840
|
-
width: number;
|
|
841
|
-
height: number;
|
|
842
|
-
checked: boolean;
|
|
843
|
-
read_only: boolean;
|
|
844
|
-
} | {
|
|
845
|
-
type: 'Dropdown';
|
|
846
|
-
name: string;
|
|
847
|
-
options: string[];
|
|
848
|
-
width: number;
|
|
849
|
-
height: number;
|
|
850
|
-
value?: string;
|
|
851
|
-
read_only: boolean;
|
|
852
|
-
font_size: number;
|
|
853
|
-
} | {
|
|
854
|
-
type: 'RadioButton';
|
|
855
|
-
name: string;
|
|
856
|
-
value: string;
|
|
857
|
-
width: number;
|
|
858
|
-
height: number;
|
|
859
|
-
checked: boolean;
|
|
860
|
-
read_only: boolean;
|
|
861
|
-
} | {
|
|
862
|
-
type: 'PageBreak';
|
|
863
|
-
};
|
|
864
|
-
export interface FormeColumnDef {
|
|
865
|
-
width: FormeColumnWidth;
|
|
866
|
-
}
|
|
867
|
-
export type FormeColumnWidth = {
|
|
868
|
-
Fraction: number;
|
|
869
|
-
} | {
|
|
870
|
-
Fixed: number;
|
|
871
|
-
} | 'Auto';
|
|
872
|
-
export type FormeDimension = {
|
|
873
|
-
Pt: number;
|
|
874
|
-
} | {
|
|
875
|
-
Percent: number;
|
|
876
|
-
} | 'Auto';
|
|
877
|
-
export interface FormeColor {
|
|
878
|
-
r: number;
|
|
879
|
-
g: number;
|
|
880
|
-
b: number;
|
|
881
|
-
a: number;
|
|
882
|
-
}
|
|
883
|
-
export interface FormeEdgeValues<T> {
|
|
884
|
-
top: T;
|
|
885
|
-
right: T;
|
|
886
|
-
bottom: T;
|
|
887
|
-
left: T;
|
|
888
|
-
}
|
|
889
|
-
export interface FormeCornerValues {
|
|
890
|
-
top_left: number;
|
|
891
|
-
top_right: number;
|
|
892
|
-
bottom_right: number;
|
|
893
|
-
bottom_left: number;
|
|
894
|
-
}
|
|
895
|
-
/** Grid track size in Forme JSON format (matches Rust GridTrackSize enum) */
|
|
896
|
-
export type FormeGridTrackSize = {
|
|
897
|
-
Pt: number;
|
|
898
|
-
} | {
|
|
899
|
-
Fr: number;
|
|
900
|
-
} | 'Auto' | {
|
|
901
|
-
MinMax: [FormeGridTrackSize, FormeGridTrackSize];
|
|
902
|
-
};
|
|
903
|
-
/** Grid placement in Forme JSON format */
|
|
904
|
-
export interface FormeGridPlacement {
|
|
905
|
-
columnStart?: number;
|
|
906
|
-
columnEnd?: number;
|
|
907
|
-
rowStart?: number;
|
|
908
|
-
rowEnd?: number;
|
|
909
|
-
columnSpan?: number;
|
|
910
|
-
rowSpan?: number;
|
|
911
|
-
}
|
|
912
|
-
/** Style in the Forme JSON format (camelCase field names, PascalCase enum values) */
|
|
913
|
-
export interface FormeStyle {
|
|
914
|
-
display?: string;
|
|
915
|
-
width?: FormeDimension;
|
|
916
|
-
height?: FormeDimension;
|
|
917
|
-
minWidth?: FormeDimension;
|
|
918
|
-
minHeight?: FormeDimension;
|
|
919
|
-
maxWidth?: FormeDimension;
|
|
920
|
-
maxHeight?: FormeDimension;
|
|
921
|
-
padding?: FormeEdges;
|
|
922
|
-
margin?: FormeMarginEdges;
|
|
923
|
-
flexDirection?: string;
|
|
924
|
-
justifyContent?: string;
|
|
925
|
-
alignItems?: string;
|
|
926
|
-
alignSelf?: string;
|
|
927
|
-
alignContent?: string;
|
|
928
|
-
flexWrap?: string;
|
|
929
|
-
flexGrow?: number;
|
|
930
|
-
flexShrink?: number;
|
|
931
|
-
flexBasis?: FormeDimension;
|
|
932
|
-
gap?: number;
|
|
933
|
-
rowGap?: number;
|
|
934
|
-
columnGap?: number;
|
|
935
|
-
gridTemplateColumns?: FormeGridTrackSize[];
|
|
936
|
-
gridTemplateRows?: FormeGridTrackSize[];
|
|
937
|
-
gridAutoRows?: FormeGridTrackSize;
|
|
938
|
-
gridAutoColumns?: FormeGridTrackSize;
|
|
939
|
-
gridPlacement?: FormeGridPlacement;
|
|
940
|
-
fontFamily?: string;
|
|
941
|
-
fontSize?: number;
|
|
942
|
-
fontWeight?: number;
|
|
943
|
-
fontStyle?: string;
|
|
944
|
-
lineHeight?: number;
|
|
945
|
-
textAlign?: string;
|
|
946
|
-
letterSpacing?: number;
|
|
947
|
-
wordSpacing?: number;
|
|
948
|
-
boxShadow?: FormeBoxShadow;
|
|
949
|
-
textDecoration?: string;
|
|
950
|
-
textTransform?: string;
|
|
951
|
-
hyphens?: string;
|
|
952
|
-
lang?: string;
|
|
953
|
-
direction?: string;
|
|
954
|
-
textOverflow?: string;
|
|
955
|
-
lineBreaking?: string;
|
|
956
|
-
overflow?: string;
|
|
957
|
-
color?: FormeColor;
|
|
958
|
-
backgroundColor?: FormeColor;
|
|
959
|
-
background?: FormeBackground;
|
|
960
|
-
opacity?: number;
|
|
961
|
-
borderWidth?: FormeEdgeValues<number>;
|
|
962
|
-
borderColor?: FormeEdgeValues<FormeColor>;
|
|
963
|
-
borderRadius?: FormeCornerValues;
|
|
964
|
-
position?: string;
|
|
965
|
-
top?: number;
|
|
966
|
-
right?: number;
|
|
967
|
-
bottom?: number;
|
|
968
|
-
left?: number;
|
|
969
|
-
wrap?: boolean;
|
|
970
|
-
breakBefore?: boolean;
|
|
971
|
-
minWidowLines?: number;
|
|
972
|
-
minOrphanLines?: number;
|
|
973
|
-
}
|