@campxdev/pdfme 1.2.2 → 1.3.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/cjs/chunks/{index-C8qZMUOU.js → fontSizePxWidget-Drk8HKGH.js} +138 -9
- package/dist/cjs/chunks/fontSizeTransform-CQQ_O42f.js +37 -0
- package/dist/cjs/chunks/{helper-BfoMn47R.js → helper-DGH62Z2s.js} +4 -0
- package/dist/cjs/chunks/{index-COKtXyPp.js → index-CoNR0xQU.js} +6 -2
- package/dist/cjs/chunks/{index-CVqJfcgy.js → index-CsEKt088.js} +697 -547
- package/dist/cjs/chunks/{pluginRegistry-C8bMreez.js → pluginRegistry-D2vr9MUy.js} +1 -1
- package/dist/cjs/common.js +7 -3
- package/dist/cjs/converter.js +1 -1
- package/dist/cjs/generator.js +3 -3
- package/dist/cjs/index.js +23 -16
- package/dist/cjs/print-designer-editor.js +3320 -3296
- package/dist/cjs/schemas.js +500 -38
- package/dist/cjs/ui.js +2007 -1868
- package/dist/esm/chunks/{index-C4F7EwBG.js → fontSizePxWidget-CbzQrSSM.js} +130 -5
- package/dist/esm/chunks/fontSizeTransform-CkTVJdRF.js +34 -0
- package/dist/esm/chunks/{helper-D5PPN6Bv.js → helper-DSxGxZ0j.js} +4 -1
- package/dist/esm/chunks/{index-CDhErAtE.js → index-DJkUkUo9.js} +4 -3
- package/dist/esm/chunks/{index-C7jr4GIK.js → index-D_-j4c4P.js} +691 -544
- package/dist/esm/chunks/{pluginRegistry-B-XSNgmK.js → pluginRegistry-Bgrz5qWG.js} +1 -1
- package/dist/esm/common.js +4 -3
- package/dist/esm/converter.js +1 -1
- package/dist/esm/generator.js +3 -3
- package/dist/esm/index.js +7 -6
- package/dist/esm/print-designer-editor.js +3307 -3286
- package/dist/esm/schemas.js +472 -13
- package/dist/esm/ui.js +2007 -1868
- package/dist/types/_vendors/common/fontSizeTransform.d.ts +5 -0
- package/dist/types/_vendors/common/helper.d.ts +1 -0
- package/dist/types/_vendors/common/index.d.ts +3 -2
- package/dist/types/_vendors/print-designer-editor/index.d.ts +2 -1
- package/dist/types/_vendors/print-designer-editor/types.d.ts +1 -1
- package/dist/types/_vendors/print-designer-editor/useDesigner.d.ts +1 -1
- package/dist/types/_vendors/schemas/index.d.ts +8 -2
- package/dist/types/_vendors/schemas/richText/helper.d.ts +3 -0
- package/dist/types/_vendors/schemas/richText/index.d.ts +4 -0
- package/dist/types/_vendors/schemas/richText/pdfRender.d.ts +3 -0
- package/dist/types/_vendors/schemas/richText/propPanel.d.ts +3 -0
- package/dist/types/_vendors/schemas/richText/types.d.ts +7 -0
- package/dist/types/_vendors/schemas/richText/uiRender.d.ts +3 -0
- package/dist/types/_vendors/schemas/singleVariableText/index.d.ts +4 -0
- package/dist/types/_vendors/schemas/singleVariableText/propPanel.d.ts +3 -0
- package/dist/types/_vendors/schemas/singleVariableText/types.d.ts +4 -0
- package/dist/types/_vendors/schemas/text/fontSizePxWidget.d.ts +9 -0
- package/dist/types/_vendors/ui/components/CtlBar.d.ts +1 -1
- package/dist/types/_vendors/ui/components/Paper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Template } from './types.js';
|
|
2
|
+
/** Convert all fontSize fields in a template from pt (pdfme internal) → px (user-facing). */
|
|
3
|
+
export declare const templatePtToPx: (template: Template) => Template;
|
|
4
|
+
/** Convert all fontSize fields in a template from px (user-facing) → pt (pdfme internal). */
|
|
5
|
+
export declare const templatePxToPt: (template: Template) => Template;
|
|
@@ -8,6 +8,7 @@ export declare const getAllFontsWithGoogle: () => Font;
|
|
|
8
8
|
export declare const mm2pt: (mm: number) => number;
|
|
9
9
|
export declare const pt2mm: (pt: number) => number;
|
|
10
10
|
export declare const pt2px: (pt: number) => number;
|
|
11
|
+
export declare const px2pt: (px: number) => number;
|
|
11
12
|
export declare const px2mm: (px: number) => number;
|
|
12
13
|
export declare const isHexValid: (hex: string) => boolean;
|
|
13
14
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PDFME_VERSION } from './version.js';
|
|
2
2
|
import { MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME } from './constants.js';
|
|
3
3
|
import type { ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, Mode, UIRenderProps, Plugin, Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps } from './types.js';
|
|
4
|
-
import { cloneDeep, getFallbackFontName, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getB64BasePdf, b64toUint8Array, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf } from './helper.js';
|
|
4
|
+
import { cloneDeep, getFallbackFontName, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getB64BasePdf, b64toUint8Array, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, mm2pt, pt2mm, pt2px, px2pt, px2mm, isHexValid, getInputFromTemplate, isBlankPdf } from './helper.js';
|
|
5
5
|
import { getDynamicTemplate } from './dynamicTemplate.js';
|
|
6
|
+
import { templatePtToPx, templatePxToPt } from './fontSizeTransform.js';
|
|
6
7
|
import { replacePlaceholders } from './expression.js';
|
|
7
8
|
import { pluginRegistry } from './pluginRegistry.js';
|
|
8
9
|
import { googleFonts, getGoogleFontsData, isGoogleFont } from './googleFonts.js';
|
|
9
|
-
export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, googleFonts, getGoogleFontsData, isGoogleFont, };
|
|
10
|
+
export { PDFME_VERSION, MM_TO_PT_RATIO, PT_TO_MM_RATIO, PT_TO_PX_RATIO, BLANK_PDF, BLANK_A4_PDF, CUSTOM_A4_PDF, ZOOM, DEFAULT_FONT_NAME, cloneDeep, getFallbackFontName, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getB64BasePdf, b64toUint8Array, mm2pt, pt2mm, pt2px, px2pt, px2mm, isHexValid, getInputFromTemplate, isBlankPdf, getDynamicTemplate, replacePlaceholders, checkFont, checkInputs, checkUIOptions, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, pluginRegistry, googleFonts, getGoogleFontsData, isGoogleFont, templatePtToPx, templatePxToPt, };
|
|
10
11
|
export type { Lang, Dict, Size, Schema, SchemaForUI, Font, ColorType, BasePdf, BlankPdf, CustomPdf, Template, CommonOptions, GeneratorOptions, Plugin, Plugins, PluginRegistry, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ChangeSchemaItem, ChangeSchemas, SchemaPageArray, PropPanel, PropPanelSchema, PropPanelWidgetProps, PDFRenderProps, UIRenderProps, Mode, };
|
|
@@ -9,6 +9,7 @@ export { useDesigner } from './useDesigner.js';
|
|
|
9
9
|
export { useDesignerContext } from './useDesignerContext.js';
|
|
10
10
|
export { convertPdfToBase64 } from './utils.js';
|
|
11
11
|
export { generate } from '../generator/index.js';
|
|
12
|
-
export { getInputFromTemplate, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getGoogleFontsData, isGoogleFont } from '../common/index.js';
|
|
12
|
+
export { getInputFromTemplate, getDefaultFont, getBuiltinFontsData, getAllFonts, getAllFontsWithGoogle, getGoogleFontsData, isGoogleFont, templatePtToPx, templatePxToPt, px2pt } from '../common/index.js';
|
|
13
13
|
export { plugins } from './plugins.js';
|
|
14
|
+
export { fontSizePxWidget } from '../schemas/index.js';
|
|
14
15
|
export type { Template, Schema, SchemaForUI, ChangeSchemas, Size, BasePdf, Font, Lang, UIOptions, Plugin, PluginRegistry, PdfmeProviderProps, DesignerContextValue, TemplateVariable, TemplateVariables, } from './types.js';
|
|
@@ -43,7 +43,7 @@ export type DesignerContextValue = {
|
|
|
43
43
|
setPageCursor: (page: number) => void;
|
|
44
44
|
addPageAfter: () => void;
|
|
45
45
|
removePage: () => void;
|
|
46
|
-
clonePageAfter: () => void;
|
|
46
|
+
clonePageAfter: (times?: number) => void;
|
|
47
47
|
handleChangePageSize: (w: number, h: number) => void;
|
|
48
48
|
handleChangePadding: (padding: [number, number, number, number]) => void;
|
|
49
49
|
handleChangeBasePdf: (basePdf: BasePdf) => void;
|
|
@@ -12,7 +12,7 @@ export declare const useDesigner: () => {
|
|
|
12
12
|
getTotalPages: () => number;
|
|
13
13
|
addPage: () => void;
|
|
14
14
|
removePage: () => void;
|
|
15
|
-
clonePage: () => void;
|
|
15
|
+
clonePage: (times?: number) => void;
|
|
16
16
|
changePageSize: (w: number, h: number) => void;
|
|
17
17
|
changePadding: (padding: [number, number, number, number]) => void;
|
|
18
18
|
undo: () => void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import multiVariableText from './multiVariableText/index.js';
|
|
2
|
+
import richText from './richText/index.js';
|
|
3
|
+
import singleVariableText from './singleVariableText/index.js';
|
|
2
4
|
import text from './text/index.js';
|
|
3
5
|
import image from './graphics/image.js';
|
|
4
6
|
import svg from './graphics/svg.js';
|
|
@@ -16,7 +18,11 @@ import checkbox from './checkbox/index.js';
|
|
|
16
18
|
import dynamicTable from './dynamicTable/index.js';
|
|
17
19
|
import variableBarcodes, { dynamicQrCode, dynamicBarcode } from './variableBarcode/index.js';
|
|
18
20
|
declare const builtInPlugins: {
|
|
19
|
-
Text: import('../common/index.js').Plugin<import("./
|
|
21
|
+
Text: import('../common/index.js').Plugin<import("./text/types.js").TextSchema>;
|
|
22
|
+
'Dynamic Text': import('../common/index.js').Plugin<import("./singleVariableText/types.js").SingleVariableTextSchema>;
|
|
23
|
+
'Rich Text': import('../common/index.js').Plugin<import("./richText/types.js").RichTextSchema>;
|
|
20
24
|
};
|
|
21
|
-
export { builtInPlugins, text,
|
|
25
|
+
export { builtInPlugins, text, singleVariableText, richText, multiVariableText, // kept for backward compatibility
|
|
26
|
+
image, svg, signature, table, barcodes, line, rectangle, ellipse, dateTime, date, time, select, radioGroup, checkbox, dynamicTable, variableBarcodes, dynamicQrCode, dynamicBarcode, };
|
|
22
27
|
export { getDynamicHeightsForTable } from './tables/dynamicTemplate.js';
|
|
28
|
+
export { fontSizePxWidget } from './text/fontSizePxWidget.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RichTextSchema } from './types.js';
|
|
2
|
+
export declare const substituteVariables: (text: string, variablesIn: string | Record<string, string>, extraContext?: Record<string, unknown>) => string;
|
|
3
|
+
export declare const validateVariables: (value: string, schema: RichTextSchema) => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropPanelWidgetProps } from '../../common/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A custom propPanel widget that displays fontSize in pixels (px) while
|
|
4
|
+
* storing the value internally in points (pt) as pdfme requires.
|
|
5
|
+
*
|
|
6
|
+
* Register as `widgets: { fontSizePxWidget }` in Designer options, then
|
|
7
|
+
* swap the fontSize field's widget to 'fontSizePxWidget' in your propPanel schema.
|
|
8
|
+
*/
|
|
9
|
+
export declare const fontSizePxWidget: (props: PropPanelWidgetProps) => void;
|
|
@@ -9,7 +9,7 @@ type CtlBarProps = {
|
|
|
9
9
|
setZoomLevel: (zoom: number) => void;
|
|
10
10
|
addPageAfter?: () => void;
|
|
11
11
|
removePage?: () => void;
|
|
12
|
-
clonePageAfter?: () => void;
|
|
12
|
+
clonePageAfter?: (times: number) => void;
|
|
13
13
|
basePdf?: BasePdf;
|
|
14
14
|
onChangePageSize?: (w: number, h: number) => void;
|
|
15
15
|
onChangePadding?: (padding: [number, number, number, number]) => void;
|