@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/font.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
src: string | Uint8Array;
|
|
4
|
-
fontWeight?: number | 'normal' | 'bold';
|
|
5
|
-
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
6
|
-
}
|
|
7
|
-
export declare const Font: {
|
|
8
|
-
register(options: FontRegistration): void;
|
|
9
|
-
clear(): void;
|
|
10
|
-
getRegistered(): FontRegistration[];
|
|
11
|
-
};
|
|
1
|
+
export { Font } from '@formepdf/shared';
|
|
2
|
+
export type { FontRegistration } from '@formepdf/shared';
|
package/dist/font.js
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function normalizeWeight(w) {
|
|
3
|
-
if (w === undefined || w === 'normal')
|
|
4
|
-
return 400;
|
|
5
|
-
if (w === 'bold')
|
|
6
|
-
return 700;
|
|
7
|
-
return typeof w === 'number' ? w : (parseInt(w, 10) || 400);
|
|
8
|
-
}
|
|
9
|
-
export const Font = {
|
|
10
|
-
register(options) {
|
|
11
|
-
globalFonts.push({
|
|
12
|
-
...options,
|
|
13
|
-
fontWeight: normalizeWeight(options.fontWeight),
|
|
14
|
-
fontStyle: options.fontStyle || 'normal',
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
clear() {
|
|
18
|
-
globalFonts.length = 0;
|
|
19
|
-
},
|
|
20
|
-
getRegistered() {
|
|
21
|
-
return [...globalFonts];
|
|
22
|
-
},
|
|
23
|
-
};
|
|
1
|
+
export { Font } from '@formepdf/shared';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { Document, Page, View, Text, H1, H2, H3, H4, H5, H6, OrderedList, UnorderedList, ListItem, Strong, Em, Code, Link, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot, TextField, Checkbox, Dropdown, RadioButton } from './components.js';
|
|
2
2
|
export { LegacyBarChart, LegacyLineChart, LegacyPieChart } from './charts.js';
|
|
3
|
-
export { serialize, serializeTemplate
|
|
3
|
+
export { serialize, serializeTemplate } from './serialize.js';
|
|
4
|
+
export { mapStyle, mapDimension, parseColor, expandEdges, expandCorners } from '@formepdf/shared';
|
|
4
5
|
export { StyleSheet } from './stylesheet.js';
|
|
5
6
|
export { Font } from './font.js';
|
|
6
7
|
export type { FontRegistration } from './font.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
export { Document, Page, View, Text, H1, H2, H3, H4, H5, H6, OrderedList, UnorderedList, ListItem, Strong, Em, Code, Link, Image, Table, Row, Cell, Fixed, Svg, QrCode, Barcode, Canvas, Watermark, PageBreak, BarChart, LineChart, PieChart, AreaChart, DotPlot, TextField, Checkbox, Dropdown, RadioButton } from './components.js';
|
|
3
3
|
export { LegacyBarChart, LegacyLineChart, LegacyPieChart } from './charts.js';
|
|
4
4
|
// Serialization
|
|
5
|
-
export { serialize, serializeTemplate
|
|
5
|
+
export { serialize, serializeTemplate } from './serialize.js';
|
|
6
|
+
export { mapStyle, mapDimension, parseColor, expandEdges, expandCorners } from '@formepdf/shared';
|
|
6
7
|
// StyleSheet
|
|
7
8
|
export { StyleSheet } from './stylesheet.js';
|
|
8
9
|
// Font registration
|
package/dist/serialize.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FormeDocument } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Serialize a React element tree into a Forme JSON document object.
|
|
5
5
|
* The top-level element must be a <Document> (or a component that returns one).
|
|
6
6
|
*/
|
|
7
7
|
export declare function serialize(element: ReactElement): FormeDocument;
|
|
8
|
-
export declare function mapStyle(style?: Style): FormeStyle;
|
|
9
|
-
export declare function mapDimension(val: number | string): FormeDimension;
|
|
10
|
-
export declare function parseColor(hex: string): FormeColor;
|
|
11
|
-
export declare function expandEdges(val: number | string | number[] | Edges): FormeEdges;
|
|
12
|
-
export declare function expandCorners(val: number | Corners): FormeCornerValues;
|
|
13
8
|
/**
|
|
14
9
|
* Serialize a React element tree into a Forme template JSON document.
|
|
15
10
|
* Like `serialize()` but with expression marker detection for template compilation.
|