@pdfme/common 2.1.0 → 2.2.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.
Files changed (43) hide show
  1. package/dist/cjs/__tests__/font.test.js +44 -0
  2. package/dist/cjs/__tests__/font.test.js.map +1 -1
  3. package/dist/cjs/__tests__/helper.test.js +10 -0
  4. package/dist/cjs/__tests__/helper.test.js.map +1 -1
  5. package/dist/cjs/src/constants.js +5 -1
  6. package/dist/cjs/src/constants.js.map +1 -1
  7. package/dist/cjs/src/font.js +34 -11
  8. package/dist/cjs/src/font.js.map +1 -1
  9. package/dist/cjs/src/helper.js +5 -1
  10. package/dist/cjs/src/helper.js.map +1 -1
  11. package/dist/cjs/src/index.js +8 -2
  12. package/dist/cjs/src/index.js.map +1 -1
  13. package/dist/cjs/src/schema.js +9 -1
  14. package/dist/cjs/src/schema.js.map +1 -1
  15. package/dist/cjs/src/type.js.map +1 -1
  16. package/dist/esm/__tests__/font.test.js +45 -1
  17. package/dist/esm/__tests__/font.test.js.map +1 -1
  18. package/dist/esm/__tests__/helper.test.js +11 -1
  19. package/dist/esm/__tests__/helper.test.js.map +1 -1
  20. package/dist/esm/src/constants.js +4 -0
  21. package/dist/esm/src/constants.js.map +1 -1
  22. package/dist/esm/src/font.js +33 -11
  23. package/dist/esm/src/font.js.map +1 -1
  24. package/dist/esm/src/helper.js +4 -1
  25. package/dist/esm/src/helper.js.map +1 -1
  26. package/dist/esm/src/index.js +4 -4
  27. package/dist/esm/src/index.js.map +1 -1
  28. package/dist/esm/src/schema.js +8 -0
  29. package/dist/esm/src/schema.js.map +1 -1
  30. package/dist/esm/src/type.js.map +1 -1
  31. package/dist/types/src/constants.d.ts +4 -0
  32. package/dist/types/src/font.d.ts +6 -8
  33. package/dist/types/src/helper.d.ts +1 -0
  34. package/dist/types/src/index.d.ts +5 -5
  35. package/dist/types/src/schema.d.ts +71 -0
  36. package/dist/types/src/type.d.ts +8 -0
  37. package/package.json +1 -1
  38. package/src/constants.ts +4 -0
  39. package/src/font.ts +42 -18
  40. package/src/helper.ts +5 -1
  41. package/src/index.ts +15 -3
  42. package/src/schema.ts +9 -0
  43. package/src/type.ts +9 -0
@@ -11,6 +11,7 @@ export declare const Size: z.ZodObject<{
11
11
  width: number;
12
12
  }>;
13
13
  export declare const Alignment: z.ZodEnum<["left", "center", "right"]>;
14
+ export declare const VerticalAlignment: z.ZodEnum<["top", "middle", "bottom"]>;
14
15
  export declare const barcodeSchemaTypes: readonly ["qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce", "gs1datamatrix"];
15
16
  export declare const schemaTypes: readonly ["text", "image", "qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce", "gs1datamatrix"];
16
17
  export declare const BarcodeSchemaType: z.ZodEnum<["qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce", "gs1datamatrix"]>;
@@ -65,6 +66,7 @@ export declare const TextSchema: z.ZodObject<{
65
66
  rotate: z.ZodOptional<z.ZodNumber>;
66
67
  type: z.ZodLiteral<"text">;
67
68
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
69
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
68
70
  fontSize: z.ZodOptional<z.ZodNumber>;
69
71
  fontName: z.ZodOptional<z.ZodString>;
70
72
  fontColor: z.ZodOptional<z.ZodString>;
@@ -94,6 +96,7 @@ export declare const TextSchema: z.ZodObject<{
94
96
  };
95
97
  rotate?: number | undefined;
96
98
  alignment?: "center" | "left" | "right" | undefined;
99
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
97
100
  fontSize?: number | undefined;
98
101
  fontName?: string | undefined;
99
102
  fontColor?: string | undefined;
@@ -115,6 +118,7 @@ export declare const TextSchema: z.ZodObject<{
115
118
  };
116
119
  rotate?: number | undefined;
117
120
  alignment?: "center" | "left" | "right" | undefined;
121
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
118
122
  fontSize?: number | undefined;
119
123
  fontName?: string | undefined;
120
124
  fontColor?: string | undefined;
@@ -211,6 +215,7 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
211
215
  rotate: z.ZodOptional<z.ZodNumber>;
212
216
  type: z.ZodLiteral<"text">;
213
217
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
218
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
214
219
  fontSize: z.ZodOptional<z.ZodNumber>;
215
220
  fontName: z.ZodOptional<z.ZodString>;
216
221
  fontColor: z.ZodOptional<z.ZodString>;
@@ -240,6 +245,7 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
240
245
  };
241
246
  rotate?: number | undefined;
242
247
  alignment?: "center" | "left" | "right" | undefined;
248
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
243
249
  fontSize?: number | undefined;
244
250
  fontName?: string | undefined;
245
251
  fontColor?: string | undefined;
@@ -261,6 +267,7 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
261
267
  };
262
268
  rotate?: number | undefined;
263
269
  alignment?: "center" | "left" | "right" | undefined;
270
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
264
271
  fontSize?: number | undefined;
265
272
  fontName?: string | undefined;
266
273
  fontColor?: string | undefined;
@@ -358,6 +365,7 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
358
365
  }>;
359
366
  rotate: z.ZodOptional<z.ZodNumber>;
360
367
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
368
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
361
369
  fontName: z.ZodOptional<z.ZodString>;
362
370
  fontColor: z.ZodOptional<z.ZodString>;
363
371
  characterSpacing: z.ZodOptional<z.ZodNumber>;
@@ -393,6 +401,7 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
393
401
  lineHeight?: number | undefined;
394
402
  rotate?: number | undefined;
395
403
  alignment?: "center" | "left" | "right" | undefined;
404
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
396
405
  fontName?: string | undefined;
397
406
  fontColor?: string | undefined;
398
407
  characterSpacing?: number | undefined;
@@ -417,6 +426,7 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
417
426
  lineHeight?: number | undefined;
418
427
  rotate?: number | undefined;
419
428
  alignment?: "center" | "left" | "right" | undefined;
429
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
420
430
  fontName?: string | undefined;
421
431
  fontColor?: string | undefined;
422
432
  characterSpacing?: number | undefined;
@@ -541,6 +551,7 @@ export declare const Template: z.ZodObject<{
541
551
  rotate: z.ZodOptional<z.ZodNumber>;
542
552
  type: z.ZodLiteral<"text">;
543
553
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
554
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
544
555
  fontSize: z.ZodOptional<z.ZodNumber>;
545
556
  fontName: z.ZodOptional<z.ZodString>;
546
557
  fontColor: z.ZodOptional<z.ZodString>;
@@ -570,6 +581,7 @@ export declare const Template: z.ZodObject<{
570
581
  };
571
582
  rotate?: number | undefined;
572
583
  alignment?: "center" | "left" | "right" | undefined;
584
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
573
585
  fontSize?: number | undefined;
574
586
  fontName?: string | undefined;
575
587
  fontColor?: string | undefined;
@@ -591,6 +603,7 @@ export declare const Template: z.ZodObject<{
591
603
  };
592
604
  rotate?: number | undefined;
593
605
  alignment?: "center" | "left" | "right" | undefined;
606
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
594
607
  fontSize?: number | undefined;
595
608
  fontName?: string | undefined;
596
609
  fontColor?: string | undefined;
@@ -683,6 +696,7 @@ export declare const Template: z.ZodObject<{
683
696
  };
684
697
  rotate?: number | undefined;
685
698
  alignment?: "center" | "left" | "right" | undefined;
699
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
686
700
  fontSize?: number | undefined;
687
701
  fontName?: string | undefined;
688
702
  fontColor?: string | undefined;
@@ -727,6 +741,7 @@ export declare const Template: z.ZodObject<{
727
741
  };
728
742
  rotate?: number | undefined;
729
743
  alignment?: "center" | "left" | "right" | undefined;
744
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
730
745
  fontSize?: number | undefined;
731
746
  fontName?: string | undefined;
732
747
  fontColor?: string | undefined;
@@ -780,6 +795,7 @@ export declare const CommonProps: z.ZodObject<{
780
795
  rotate: z.ZodOptional<z.ZodNumber>;
781
796
  type: z.ZodLiteral<"text">;
782
797
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
798
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
783
799
  fontSize: z.ZodOptional<z.ZodNumber>;
784
800
  fontName: z.ZodOptional<z.ZodString>;
785
801
  fontColor: z.ZodOptional<z.ZodString>;
@@ -809,6 +825,7 @@ export declare const CommonProps: z.ZodObject<{
809
825
  };
810
826
  rotate?: number | undefined;
811
827
  alignment?: "center" | "left" | "right" | undefined;
828
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
812
829
  fontSize?: number | undefined;
813
830
  fontName?: string | undefined;
814
831
  fontColor?: string | undefined;
@@ -830,6 +847,7 @@ export declare const CommonProps: z.ZodObject<{
830
847
  };
831
848
  rotate?: number | undefined;
832
849
  alignment?: "center" | "left" | "right" | undefined;
850
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
833
851
  fontSize?: number | undefined;
834
852
  fontName?: string | undefined;
835
853
  fontColor?: string | undefined;
@@ -922,6 +940,7 @@ export declare const CommonProps: z.ZodObject<{
922
940
  };
923
941
  rotate?: number | undefined;
924
942
  alignment?: "center" | "left" | "right" | undefined;
943
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
925
944
  fontSize?: number | undefined;
926
945
  fontName?: string | undefined;
927
946
  fontColor?: string | undefined;
@@ -966,6 +985,7 @@ export declare const CommonProps: z.ZodObject<{
966
985
  };
967
986
  rotate?: number | undefined;
968
987
  alignment?: "center" | "left" | "right" | undefined;
988
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
969
989
  fontSize?: number | undefined;
970
990
  fontName?: string | undefined;
971
991
  fontColor?: string | undefined;
@@ -1039,6 +1059,7 @@ export declare const CommonProps: z.ZodObject<{
1039
1059
  };
1040
1060
  rotate?: number | undefined;
1041
1061
  alignment?: "center" | "left" | "right" | undefined;
1062
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1042
1063
  fontSize?: number | undefined;
1043
1064
  fontName?: string | undefined;
1044
1065
  fontColor?: string | undefined;
@@ -1092,6 +1113,7 @@ export declare const CommonProps: z.ZodObject<{
1092
1113
  };
1093
1114
  rotate?: number | undefined;
1094
1115
  alignment?: "center" | "left" | "right" | undefined;
1116
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1095
1117
  fontSize?: number | undefined;
1096
1118
  fontName?: string | undefined;
1097
1119
  fontColor?: string | undefined;
@@ -1179,6 +1201,7 @@ export declare const GenerateProps: z.ZodObject<{
1179
1201
  rotate: z.ZodOptional<z.ZodNumber>;
1180
1202
  type: z.ZodLiteral<"text">;
1181
1203
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
1204
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
1182
1205
  fontSize: z.ZodOptional<z.ZodNumber>;
1183
1206
  fontName: z.ZodOptional<z.ZodString>;
1184
1207
  fontColor: z.ZodOptional<z.ZodString>;
@@ -1208,6 +1231,7 @@ export declare const GenerateProps: z.ZodObject<{
1208
1231
  };
1209
1232
  rotate?: number | undefined;
1210
1233
  alignment?: "center" | "left" | "right" | undefined;
1234
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1211
1235
  fontSize?: number | undefined;
1212
1236
  fontName?: string | undefined;
1213
1237
  fontColor?: string | undefined;
@@ -1229,6 +1253,7 @@ export declare const GenerateProps: z.ZodObject<{
1229
1253
  };
1230
1254
  rotate?: number | undefined;
1231
1255
  alignment?: "center" | "left" | "right" | undefined;
1256
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1232
1257
  fontSize?: number | undefined;
1233
1258
  fontName?: string | undefined;
1234
1259
  fontColor?: string | undefined;
@@ -1321,6 +1346,7 @@ export declare const GenerateProps: z.ZodObject<{
1321
1346
  };
1322
1347
  rotate?: number | undefined;
1323
1348
  alignment?: "center" | "left" | "right" | undefined;
1349
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1324
1350
  fontSize?: number | undefined;
1325
1351
  fontName?: string | undefined;
1326
1352
  fontColor?: string | undefined;
@@ -1365,6 +1391,7 @@ export declare const GenerateProps: z.ZodObject<{
1365
1391
  };
1366
1392
  rotate?: number | undefined;
1367
1393
  alignment?: "center" | "left" | "right" | undefined;
1394
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1368
1395
  fontSize?: number | undefined;
1369
1396
  fontName?: string | undefined;
1370
1397
  fontColor?: string | undefined;
@@ -1439,6 +1466,7 @@ export declare const GenerateProps: z.ZodObject<{
1439
1466
  };
1440
1467
  rotate?: number | undefined;
1441
1468
  alignment?: "center" | "left" | "right" | undefined;
1469
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1442
1470
  fontSize?: number | undefined;
1443
1471
  fontName?: string | undefined;
1444
1472
  fontColor?: string | undefined;
@@ -1493,6 +1521,7 @@ export declare const GenerateProps: z.ZodObject<{
1493
1521
  };
1494
1522
  rotate?: number | undefined;
1495
1523
  alignment?: "center" | "left" | "right" | undefined;
1524
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1496
1525
  fontSize?: number | undefined;
1497
1526
  fontName?: string | undefined;
1498
1527
  fontColor?: string | undefined;
@@ -1585,6 +1614,7 @@ export declare const UIProps: z.ZodObject<{
1585
1614
  rotate: z.ZodOptional<z.ZodNumber>;
1586
1615
  type: z.ZodLiteral<"text">;
1587
1616
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
1617
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
1588
1618
  fontSize: z.ZodOptional<z.ZodNumber>;
1589
1619
  fontName: z.ZodOptional<z.ZodString>;
1590
1620
  fontColor: z.ZodOptional<z.ZodString>;
@@ -1614,6 +1644,7 @@ export declare const UIProps: z.ZodObject<{
1614
1644
  };
1615
1645
  rotate?: number | undefined;
1616
1646
  alignment?: "center" | "left" | "right" | undefined;
1647
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1617
1648
  fontSize?: number | undefined;
1618
1649
  fontName?: string | undefined;
1619
1650
  fontColor?: string | undefined;
@@ -1635,6 +1666,7 @@ export declare const UIProps: z.ZodObject<{
1635
1666
  };
1636
1667
  rotate?: number | undefined;
1637
1668
  alignment?: "center" | "left" | "right" | undefined;
1669
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1638
1670
  fontSize?: number | undefined;
1639
1671
  fontName?: string | undefined;
1640
1672
  fontColor?: string | undefined;
@@ -1727,6 +1759,7 @@ export declare const UIProps: z.ZodObject<{
1727
1759
  };
1728
1760
  rotate?: number | undefined;
1729
1761
  alignment?: "center" | "left" | "right" | undefined;
1762
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1730
1763
  fontSize?: number | undefined;
1731
1764
  fontName?: string | undefined;
1732
1765
  fontColor?: string | undefined;
@@ -1771,6 +1804,7 @@ export declare const UIProps: z.ZodObject<{
1771
1804
  };
1772
1805
  rotate?: number | undefined;
1773
1806
  alignment?: "center" | "left" | "right" | undefined;
1807
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1774
1808
  fontSize?: number | undefined;
1775
1809
  fontName?: string | undefined;
1776
1810
  fontColor?: string | undefined;
@@ -1848,6 +1882,7 @@ export declare const UIProps: z.ZodObject<{
1848
1882
  };
1849
1883
  rotate?: number | undefined;
1850
1884
  alignment?: "center" | "left" | "right" | undefined;
1885
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1851
1886
  fontSize?: number | undefined;
1852
1887
  fontName?: string | undefined;
1853
1888
  fontColor?: string | undefined;
@@ -1903,6 +1938,7 @@ export declare const UIProps: z.ZodObject<{
1903
1938
  };
1904
1939
  rotate?: number | undefined;
1905
1940
  alignment?: "center" | "left" | "right" | undefined;
1941
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1906
1942
  fontSize?: number | undefined;
1907
1943
  fontName?: string | undefined;
1908
1944
  fontColor?: string | undefined;
@@ -1965,6 +2001,7 @@ export declare const PreviewProps: z.ZodObject<{
1965
2001
  rotate: z.ZodOptional<z.ZodNumber>;
1966
2002
  type: z.ZodLiteral<"text">;
1967
2003
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
2004
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
1968
2005
  fontSize: z.ZodOptional<z.ZodNumber>;
1969
2006
  fontName: z.ZodOptional<z.ZodString>;
1970
2007
  fontColor: z.ZodOptional<z.ZodString>;
@@ -1994,6 +2031,7 @@ export declare const PreviewProps: z.ZodObject<{
1994
2031
  };
1995
2032
  rotate?: number | undefined;
1996
2033
  alignment?: "center" | "left" | "right" | undefined;
2034
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
1997
2035
  fontSize?: number | undefined;
1998
2036
  fontName?: string | undefined;
1999
2037
  fontColor?: string | undefined;
@@ -2015,6 +2053,7 @@ export declare const PreviewProps: z.ZodObject<{
2015
2053
  };
2016
2054
  rotate?: number | undefined;
2017
2055
  alignment?: "center" | "left" | "right" | undefined;
2056
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2018
2057
  fontSize?: number | undefined;
2019
2058
  fontName?: string | undefined;
2020
2059
  fontColor?: string | undefined;
@@ -2107,6 +2146,7 @@ export declare const PreviewProps: z.ZodObject<{
2107
2146
  };
2108
2147
  rotate?: number | undefined;
2109
2148
  alignment?: "center" | "left" | "right" | undefined;
2149
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2110
2150
  fontSize?: number | undefined;
2111
2151
  fontName?: string | undefined;
2112
2152
  fontColor?: string | undefined;
@@ -2151,6 +2191,7 @@ export declare const PreviewProps: z.ZodObject<{
2151
2191
  };
2152
2192
  rotate?: number | undefined;
2153
2193
  alignment?: "center" | "left" | "right" | undefined;
2194
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2154
2195
  fontSize?: number | undefined;
2155
2196
  fontName?: string | undefined;
2156
2197
  fontColor?: string | undefined;
@@ -2229,6 +2270,7 @@ export declare const PreviewProps: z.ZodObject<{
2229
2270
  };
2230
2271
  rotate?: number | undefined;
2231
2272
  alignment?: "center" | "left" | "right" | undefined;
2273
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2232
2274
  fontSize?: number | undefined;
2233
2275
  fontName?: string | undefined;
2234
2276
  fontColor?: string | undefined;
@@ -2285,6 +2327,7 @@ export declare const PreviewProps: z.ZodObject<{
2285
2327
  };
2286
2328
  rotate?: number | undefined;
2287
2329
  alignment?: "center" | "left" | "right" | undefined;
2330
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2288
2331
  fontSize?: number | undefined;
2289
2332
  fontName?: string | undefined;
2290
2333
  fontColor?: string | undefined;
@@ -2348,6 +2391,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2348
2391
  rotate: z.ZodOptional<z.ZodNumber>;
2349
2392
  type: z.ZodLiteral<"text">;
2350
2393
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
2394
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
2351
2395
  fontSize: z.ZodOptional<z.ZodNumber>;
2352
2396
  fontName: z.ZodOptional<z.ZodString>;
2353
2397
  fontColor: z.ZodOptional<z.ZodString>;
@@ -2377,6 +2421,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2377
2421
  };
2378
2422
  rotate?: number | undefined;
2379
2423
  alignment?: "center" | "left" | "right" | undefined;
2424
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2380
2425
  fontSize?: number | undefined;
2381
2426
  fontName?: string | undefined;
2382
2427
  fontColor?: string | undefined;
@@ -2398,6 +2443,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2398
2443
  };
2399
2444
  rotate?: number | undefined;
2400
2445
  alignment?: "center" | "left" | "right" | undefined;
2446
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2401
2447
  fontSize?: number | undefined;
2402
2448
  fontName?: string | undefined;
2403
2449
  fontColor?: string | undefined;
@@ -2490,6 +2536,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2490
2536
  };
2491
2537
  rotate?: number | undefined;
2492
2538
  alignment?: "center" | "left" | "right" | undefined;
2539
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2493
2540
  fontSize?: number | undefined;
2494
2541
  fontName?: string | undefined;
2495
2542
  fontColor?: string | undefined;
@@ -2534,6 +2581,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2534
2581
  };
2535
2582
  rotate?: number | undefined;
2536
2583
  alignment?: "center" | "left" | "right" | undefined;
2584
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2537
2585
  fontSize?: number | undefined;
2538
2586
  fontName?: string | undefined;
2539
2587
  fontColor?: string | undefined;
@@ -2634,6 +2682,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2634
2682
  };
2635
2683
  rotate?: number | undefined;
2636
2684
  alignment?: "center" | "left" | "right" | undefined;
2685
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2637
2686
  fontSize?: number | undefined;
2638
2687
  fontName?: string | undefined;
2639
2688
  fontColor?: string | undefined;
@@ -2698,6 +2747,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2698
2747
  };
2699
2748
  rotate?: number | undefined;
2700
2749
  alignment?: "center" | "left" | "right" | undefined;
2750
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2701
2751
  fontSize?: number | undefined;
2702
2752
  fontName?: string | undefined;
2703
2753
  fontColor?: string | undefined;
@@ -2769,6 +2819,7 @@ export declare const DesignerProps: z.ZodObject<{
2769
2819
  rotate: z.ZodOptional<z.ZodNumber>;
2770
2820
  type: z.ZodLiteral<"text">;
2771
2821
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
2822
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
2772
2823
  fontSize: z.ZodOptional<z.ZodNumber>;
2773
2824
  fontName: z.ZodOptional<z.ZodString>;
2774
2825
  fontColor: z.ZodOptional<z.ZodString>;
@@ -2798,6 +2849,7 @@ export declare const DesignerProps: z.ZodObject<{
2798
2849
  };
2799
2850
  rotate?: number | undefined;
2800
2851
  alignment?: "center" | "left" | "right" | undefined;
2852
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2801
2853
  fontSize?: number | undefined;
2802
2854
  fontName?: string | undefined;
2803
2855
  fontColor?: string | undefined;
@@ -2819,6 +2871,7 @@ export declare const DesignerProps: z.ZodObject<{
2819
2871
  };
2820
2872
  rotate?: number | undefined;
2821
2873
  alignment?: "center" | "left" | "right" | undefined;
2874
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2822
2875
  fontSize?: number | undefined;
2823
2876
  fontName?: string | undefined;
2824
2877
  fontColor?: string | undefined;
@@ -2911,6 +2964,7 @@ export declare const DesignerProps: z.ZodObject<{
2911
2964
  };
2912
2965
  rotate?: number | undefined;
2913
2966
  alignment?: "center" | "left" | "right" | undefined;
2967
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2914
2968
  fontSize?: number | undefined;
2915
2969
  fontName?: string | undefined;
2916
2970
  fontColor?: string | undefined;
@@ -2955,6 +3009,7 @@ export declare const DesignerProps: z.ZodObject<{
2955
3009
  };
2956
3010
  rotate?: number | undefined;
2957
3011
  alignment?: "center" | "left" | "right" | undefined;
3012
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
2958
3013
  fontSize?: number | undefined;
2959
3014
  fontName?: string | undefined;
2960
3015
  fontColor?: string | undefined;
@@ -3032,6 +3087,7 @@ export declare const DesignerProps: z.ZodObject<{
3032
3087
  };
3033
3088
  rotate?: number | undefined;
3034
3089
  alignment?: "center" | "left" | "right" | undefined;
3090
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3035
3091
  fontSize?: number | undefined;
3036
3092
  fontName?: string | undefined;
3037
3093
  fontColor?: string | undefined;
@@ -3087,6 +3143,7 @@ export declare const DesignerProps: z.ZodObject<{
3087
3143
  };
3088
3144
  rotate?: number | undefined;
3089
3145
  alignment?: "center" | "left" | "right" | undefined;
3146
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3090
3147
  fontSize?: number | undefined;
3091
3148
  fontName?: string | undefined;
3092
3149
  fontColor?: string | undefined;
@@ -3149,6 +3206,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3149
3206
  rotate: z.ZodOptional<z.ZodNumber>;
3150
3207
  type: z.ZodLiteral<"text">;
3151
3208
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
3209
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
3152
3210
  fontSize: z.ZodOptional<z.ZodNumber>;
3153
3211
  fontName: z.ZodOptional<z.ZodString>;
3154
3212
  fontColor: z.ZodOptional<z.ZodString>;
@@ -3178,6 +3236,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3178
3236
  };
3179
3237
  rotate?: number | undefined;
3180
3238
  alignment?: "center" | "left" | "right" | undefined;
3239
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3181
3240
  fontSize?: number | undefined;
3182
3241
  fontName?: string | undefined;
3183
3242
  fontColor?: string | undefined;
@@ -3199,6 +3258,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3199
3258
  };
3200
3259
  rotate?: number | undefined;
3201
3260
  alignment?: "center" | "left" | "right" | undefined;
3261
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3202
3262
  fontSize?: number | undefined;
3203
3263
  fontName?: string | undefined;
3204
3264
  fontColor?: string | undefined;
@@ -3291,6 +3351,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3291
3351
  };
3292
3352
  rotate?: number | undefined;
3293
3353
  alignment?: "center" | "left" | "right" | undefined;
3354
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3294
3355
  fontSize?: number | undefined;
3295
3356
  fontName?: string | undefined;
3296
3357
  fontColor?: string | undefined;
@@ -3335,6 +3396,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3335
3396
  };
3336
3397
  rotate?: number | undefined;
3337
3398
  alignment?: "center" | "left" | "right" | undefined;
3399
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3338
3400
  fontSize?: number | undefined;
3339
3401
  fontName?: string | undefined;
3340
3402
  fontColor?: string | undefined;
@@ -3416,6 +3478,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3416
3478
  rotate: z.ZodOptional<z.ZodNumber>;
3417
3479
  type: z.ZodLiteral<"text">;
3418
3480
  alignment: z.ZodOptional<z.ZodEnum<["left", "center", "right"]>>;
3481
+ verticalAlignment: z.ZodOptional<z.ZodEnum<["top", "middle", "bottom"]>>;
3419
3482
  fontSize: z.ZodOptional<z.ZodNumber>;
3420
3483
  fontName: z.ZodOptional<z.ZodString>;
3421
3484
  fontColor: z.ZodOptional<z.ZodString>;
@@ -3445,6 +3508,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3445
3508
  };
3446
3509
  rotate?: number | undefined;
3447
3510
  alignment?: "center" | "left" | "right" | undefined;
3511
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3448
3512
  fontSize?: number | undefined;
3449
3513
  fontName?: string | undefined;
3450
3514
  fontColor?: string | undefined;
@@ -3466,6 +3530,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3466
3530
  };
3467
3531
  rotate?: number | undefined;
3468
3532
  alignment?: "center" | "left" | "right" | undefined;
3533
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3469
3534
  fontSize?: number | undefined;
3470
3535
  fontName?: string | undefined;
3471
3536
  fontColor?: string | undefined;
@@ -3558,6 +3623,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3558
3623
  };
3559
3624
  rotate?: number | undefined;
3560
3625
  alignment?: "center" | "left" | "right" | undefined;
3626
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3561
3627
  fontSize?: number | undefined;
3562
3628
  fontName?: string | undefined;
3563
3629
  fontColor?: string | undefined;
@@ -3602,6 +3668,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3602
3668
  };
3603
3669
  rotate?: number | undefined;
3604
3670
  alignment?: "center" | "left" | "right" | undefined;
3671
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3605
3672
  fontSize?: number | undefined;
3606
3673
  fontName?: string | undefined;
3607
3674
  fontColor?: string | undefined;
@@ -3658,6 +3725,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3658
3725
  };
3659
3726
  rotate?: number | undefined;
3660
3727
  alignment?: "center" | "left" | "right" | undefined;
3728
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3661
3729
  fontSize?: number | undefined;
3662
3730
  fontName?: string | undefined;
3663
3731
  fontColor?: string | undefined;
@@ -3707,6 +3775,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3707
3775
  };
3708
3776
  rotate?: number | undefined;
3709
3777
  alignment?: "center" | "left" | "right" | undefined;
3778
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3710
3779
  fontSize?: number | undefined;
3711
3780
  fontName?: string | undefined;
3712
3781
  fontColor?: string | undefined;
@@ -3761,6 +3830,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3761
3830
  };
3762
3831
  rotate?: number | undefined;
3763
3832
  alignment?: "center" | "left" | "right" | undefined;
3833
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3764
3834
  fontSize?: number | undefined;
3765
3835
  fontName?: string | undefined;
3766
3836
  fontColor?: string | undefined;
@@ -3810,6 +3880,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3810
3880
  };
3811
3881
  rotate?: number | undefined;
3812
3882
  alignment?: "center" | "left" | "right" | undefined;
3883
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
3813
3884
  fontSize?: number | undefined;
3814
3885
  fontName?: string | undefined;
3815
3886
  fontColor?: string | undefined;
@@ -1,5 +1,12 @@
1
1
  import { z } from 'zod';
2
+ import type { Font as FontKitFont } from 'fontkit';
2
3
  import { Lang, Size, Alignment, BarcodeSchemaType, SchemaType, CommonSchema as _CommonSchema, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaInputs, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps } from './schema.js';
4
+ export declare type FontWidthCalcValues = {
5
+ font: FontKitFont;
6
+ fontSize: number;
7
+ characterSpacing: number;
8
+ boxWidthInPt: number;
9
+ };
3
10
  declare type CommonSchema = z.infer<typeof _CommonSchema>;
4
11
  export declare const schemaTypes: readonly ["text", "image", "qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce", "gs1datamatrix"];
5
12
  export declare const isTextSchema: (arg: CommonSchema) => arg is {
@@ -12,6 +19,7 @@ export declare const isTextSchema: (arg: CommonSchema) => arg is {
12
19
  };
13
20
  rotate?: number | undefined;
14
21
  alignment?: "center" | "left" | "right" | undefined;
22
+ verticalAlignment?: "top" | "bottom" | "middle" | undefined;
15
23
  fontSize?: number | undefined;
16
24
  fontName?: string | undefined;
17
25
  fontColor?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/constants.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export const DEFAULT_FONT_NAME = 'Roboto';
2
2
  export const DEFAULT_FONT_SIZE = 13;
3
3
  export const DEFAULT_ALIGNMENT = 'left';
4
+ export const VERTICAL_ALIGN_TOP = 'top';
5
+ export const VERTICAL_ALIGN_MIDDLE = 'middle';
6
+ export const VERTICAL_ALIGN_BOTTOM = 'bottom';
7
+ export const DEFAULT_VERTICAL_ALIGNMENT = VERTICAL_ALIGN_TOP;
4
8
  export const DEFAULT_LINE_HEIGHT = 1;
5
9
  export const DEFAULT_CHARACTER_SPACING = 0;
6
10
  export const DEFAULT_FONT_COLOR = '#000';