@pdfme/schemas 6.0.6-dev.14 → 6.0.6-dev.17
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/builtins-C0BvXHWr.js +1388 -0
- package/dist/builtins-C0BvXHWr.js.map +1 -0
- package/dist/builtins.js +1 -1
- package/dist/{dynamicTemplate-DxHU9waC.js → dynamicTemplate-Dsrw11aL.js} +13 -2
- package/dist/dynamicTemplate-Dsrw11aL.js.map +1 -0
- package/dist/index.js +123 -18
- package/dist/index.js.map +1 -1
- package/dist/multiVariableText/helper.d.ts +2 -1
- package/dist/tables.js +1 -1
- package/dist/text/constants.d.ts +13 -0
- package/dist/text/inlineMarkdown.d.ts +4 -0
- package/dist/text/richText.d.ts +46 -0
- package/dist/text/richTextPdfRender.d.ts +34 -0
- package/dist/text/types.d.ts +18 -0
- package/dist/text/uiRender.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +2 -2
- package/dist/builtins-KUsYW25j.js +0 -613
- package/dist/builtins-KUsYW25j.js.map +0 -1
- package/dist/dynamicTemplate-DxHU9waC.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { MultiVariableTextSchema } from './types.js';
|
|
2
|
-
export declare const substituteVariables: (text: string, variablesIn: string | Record<string, string
|
|
2
|
+
export declare const substituteVariables: (text: string, variablesIn: string | Record<string, string>, valueMapper?: (value: string, variableName: string) => string) => string;
|
|
3
|
+
export declare const substituteVariablesAsInlineMarkdownLiterals: (text: string, variablesIn: string | Record<string, string>) => string;
|
|
3
4
|
export declare const validateVariables: (value: string, schema: MultiVariableTextSchema) => boolean;
|
package/dist/tables.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as getDynamicHeightsForTable } from "./dynamicTemplate-
|
|
1
|
+
import { t as getDynamicHeightsForTable } from "./dynamicTemplate-Dsrw11aL.js";
|
|
2
2
|
export { getDynamicHeightsForTable };
|
package/dist/text/constants.d.ts
CHANGED
|
@@ -13,6 +13,19 @@ export declare const DEFAULT_LINE_HEIGHT = 1;
|
|
|
13
13
|
export declare const DEFAULT_CHARACTER_SPACING = 0;
|
|
14
14
|
export declare const DEFAULT_FONT_COLOR = "#000000";
|
|
15
15
|
export declare const PLACEHOLDER_FONT_COLOR = "#A0A0A0";
|
|
16
|
+
export declare const TEXT_FORMAT_PLAIN: "plain";
|
|
17
|
+
export declare const TEXT_FORMAT_INLINE_MARKDOWN: "inline-markdown";
|
|
18
|
+
export declare const DEFAULT_TEXT_FORMAT: "plain";
|
|
19
|
+
export declare const FONT_VARIANT_FALLBACK_SYNTHETIC: "synthetic";
|
|
20
|
+
export declare const FONT_VARIANT_FALLBACK_PLAIN: "plain";
|
|
21
|
+
export declare const FONT_VARIANT_FALLBACK_ERROR: "error";
|
|
22
|
+
export declare const DEFAULT_FONT_VARIANT_FALLBACK: "synthetic";
|
|
23
|
+
export declare const SYNTHETIC_BOLD_OFFSET_RATIO = 0.03;
|
|
24
|
+
export declare const SYNTHETIC_BOLD_PDF_EXTRA_DRAWS = 2;
|
|
25
|
+
export declare const SYNTHETIC_BOLD_CSS_TEXT_SHADOW = "0.025em 0 0 currentColor";
|
|
26
|
+
export declare const SYNTHETIC_ITALIC_SKEW_DEGREES = 12;
|
|
27
|
+
export declare const CODE_BACKGROUND_COLOR = "#f2f3f5";
|
|
28
|
+
export declare const CODE_HORIZONTAL_PADDING = 1.5;
|
|
16
29
|
export declare const DYNAMIC_FIT_VERTICAL: DYNAMIC_FONT_SIZE_FIT;
|
|
17
30
|
export declare const DYNAMIC_FIT_HORIZONTAL: DYNAMIC_FONT_SIZE_FIT;
|
|
18
31
|
export declare const DEFAULT_DYNAMIC_FIT: DYNAMIC_FONT_SIZE_FIT;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Font } from '@pdfme/common';
|
|
2
|
+
import type { Font as FontKitFont } from 'fontkit';
|
|
3
|
+
import type { RichTextRun, TextSchema } from './types.js';
|
|
4
|
+
export type ResolvedRichTextRun = RichTextRun & {
|
|
5
|
+
fontName: string;
|
|
6
|
+
fontKitFont: FontKitFont;
|
|
7
|
+
syntheticBold: boolean;
|
|
8
|
+
syntheticItalic: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type RichTextLineRun = ResolvedRichTextRun & {
|
|
11
|
+
width: number;
|
|
12
|
+
};
|
|
13
|
+
export type RichTextLine = {
|
|
14
|
+
runs: RichTextLineRun[];
|
|
15
|
+
width: number;
|
|
16
|
+
hardBreak: boolean;
|
|
17
|
+
};
|
|
18
|
+
type FontVariantResolution = {
|
|
19
|
+
fontName: string;
|
|
20
|
+
syntheticBold: boolean;
|
|
21
|
+
syntheticItalic: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const isInlineMarkdownTextSchema: (schema: TextSchema) => boolean;
|
|
24
|
+
export declare const resolveFontVariant: (run: RichTextRun, schema: TextSchema, font: Font) => FontVariantResolution;
|
|
25
|
+
export declare const resolveRichTextRuns: (arg: {
|
|
26
|
+
runs: RichTextRun[];
|
|
27
|
+
schema: TextSchema;
|
|
28
|
+
font: Font;
|
|
29
|
+
_cache: Map<string | number, unknown>;
|
|
30
|
+
}) => Promise<ResolvedRichTextRun[]>;
|
|
31
|
+
export declare const countRichTextLineGraphemes: (line: RichTextLine) => number;
|
|
32
|
+
export declare const getRichTextLineText: (line: RichTextLine) => string;
|
|
33
|
+
export declare const layoutRichTextLines: (arg: {
|
|
34
|
+
runs: ResolvedRichTextRun[];
|
|
35
|
+
fontSize: number;
|
|
36
|
+
characterSpacing: number;
|
|
37
|
+
boxWidthInPt: number;
|
|
38
|
+
}) => RichTextLine[];
|
|
39
|
+
export declare const calculateDynamicRichTextFontSize: (arg: {
|
|
40
|
+
value: string;
|
|
41
|
+
schema: TextSchema;
|
|
42
|
+
font: Font;
|
|
43
|
+
_cache: Map<string | number, unknown>;
|
|
44
|
+
startingFontSize?: number | undefined;
|
|
45
|
+
}) => Promise<number>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PDFFont, Rotation } from '@pdfme/pdf-lib';
|
|
2
|
+
import type { ColorType, Font, PDFRenderProps } from '@pdfme/common';
|
|
3
|
+
import type { Font as FontKitFont } from 'fontkit';
|
|
4
|
+
import type { TextSchema } from './types.js';
|
|
5
|
+
import { hex2PrintingColor } from '../utils.js';
|
|
6
|
+
type TextColor = ReturnType<typeof hex2PrintingColor>;
|
|
7
|
+
export declare const renderInlineMarkdownText: (arg: {
|
|
8
|
+
value: string;
|
|
9
|
+
schema: TextSchema;
|
|
10
|
+
font: Font;
|
|
11
|
+
pdfFontObj: Record<string, PDFFont>;
|
|
12
|
+
fontKitFont: FontKitFont;
|
|
13
|
+
page: PDFRenderProps<TextSchema>["page"];
|
|
14
|
+
pdfLib: PDFRenderProps<TextSchema>["pdfLib"];
|
|
15
|
+
_cache: Map<string | number, unknown>;
|
|
16
|
+
colorType: ColorType;
|
|
17
|
+
fontSize: number;
|
|
18
|
+
color: TextColor;
|
|
19
|
+
alignment: string;
|
|
20
|
+
verticalAlignment: string;
|
|
21
|
+
lineHeight: number;
|
|
22
|
+
characterSpacing: number;
|
|
23
|
+
x: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
pageHeight: number;
|
|
27
|
+
pivotPoint: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
rotate: Rotation;
|
|
32
|
+
opacity: number | undefined;
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
export {};
|
package/dist/text/types.d.ts
CHANGED
|
@@ -3,6 +3,21 @@ import type { Font as FontKitFont } from 'fontkit';
|
|
|
3
3
|
export type ALIGNMENT = 'left' | 'center' | 'right' | 'justify';
|
|
4
4
|
export type VERTICAL_ALIGNMENT = 'top' | 'middle' | 'bottom';
|
|
5
5
|
export type DYNAMIC_FONT_SIZE_FIT = 'horizontal' | 'vertical';
|
|
6
|
+
export type TEXT_FORMAT = 'plain' | 'inline-markdown';
|
|
7
|
+
export type FONT_VARIANT_FALLBACK = 'synthetic' | 'plain' | 'error';
|
|
8
|
+
export type FontVariants = {
|
|
9
|
+
bold?: string;
|
|
10
|
+
italic?: string;
|
|
11
|
+
boldItalic?: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
};
|
|
14
|
+
export type RichTextRun = {
|
|
15
|
+
text: string;
|
|
16
|
+
bold?: boolean;
|
|
17
|
+
italic?: boolean;
|
|
18
|
+
strikethrough?: boolean;
|
|
19
|
+
code?: boolean;
|
|
20
|
+
};
|
|
6
21
|
export type FontWidthCalcValues = {
|
|
7
22
|
font: FontKitFont;
|
|
8
23
|
fontSize: number;
|
|
@@ -11,6 +26,9 @@ export type FontWidthCalcValues = {
|
|
|
11
26
|
};
|
|
12
27
|
export type TextSchema = Schema & {
|
|
13
28
|
fontName?: string;
|
|
29
|
+
textFormat?: TEXT_FORMAT;
|
|
30
|
+
fontVariants?: FontVariants;
|
|
31
|
+
fontVariantFallback?: FONT_VARIANT_FALLBACK;
|
|
14
32
|
alignment: ALIGNMENT;
|
|
15
33
|
verticalAlignment: VERTICAL_ALIGNMENT;
|
|
16
34
|
fontSize: number;
|
package/dist/text/uiRender.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Font as FontKitFont } from 'fontkit';
|
|
|
2
2
|
import { UIRenderProps } from '@pdfme/common';
|
|
3
3
|
import type { TextSchema } from './types.js';
|
|
4
4
|
export declare const uiRender: (arg: UIRenderProps<TextSchema>) => Promise<void>;
|
|
5
|
-
export declare const buildStyledTextContainer: (arg: UIRenderProps<TextSchema>, fontKitFont: FontKitFont, value: string) => HTMLDivElement;
|
|
5
|
+
export declare const buildStyledTextContainer: (arg: UIRenderProps<TextSchema>, fontKitFont: FontKitFont, value: string, resolvedDynamicFontSize?: number) => HTMLDivElement;
|
|
6
6
|
/**
|
|
7
7
|
* Firefox doesn't support 'plaintext-only' contentEditable mode, which we want to avoid mark-up.
|
|
8
8
|
* This function adds a workaround for Firefox to make the contentEditable element behave like 'plaintext-only'.
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as getDynamicHeightsForTable$1 } from "./dynamicTemplate-
|
|
1
|
+
import { t as getDynamicHeightsForTable$1 } from "./dynamicTemplate-Dsrw11aL.js";
|
|
2
2
|
import { isHexValid, mm2pt } from "@pdfme/common";
|
|
3
3
|
import { cmyk, degrees, degreesToRadians, rgb } from "@pdfme/pdf-lib";
|
|
4
4
|
//#region src/utils.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/schemas",
|
|
3
|
-
"version": "6.0.6-dev.
|
|
3
|
+
"version": "6.0.6-dev.17",
|
|
4
4
|
"description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pdf",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"date-fns": "^4.1.0",
|
|
70
70
|
"dompurify": "^3.4.1",
|
|
71
71
|
"fontkit": "^2.0.2",
|
|
72
|
-
"lucide": "^1.
|
|
72
|
+
"lucide": "^1.12.0",
|
|
73
73
|
"signature_pad": "^5.1.3"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|