@pdfme/common 2.0.2 → 2.1.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 (40) hide show
  1. package/dist/cjs/__tests__/font.test.js +193 -27
  2. package/dist/cjs/__tests__/font.test.js.map +1 -1
  3. package/dist/cjs/__tests__/helper.test.js +15 -0
  4. package/dist/cjs/__tests__/helper.test.js.map +1 -1
  5. package/dist/cjs/src/constants.js +8 -5
  6. package/dist/cjs/src/constants.js.map +1 -1
  7. package/dist/cjs/src/font.js +147 -38
  8. package/dist/cjs/src/font.js.map +1 -1
  9. package/dist/cjs/src/helper.js +10 -1
  10. package/dist/cjs/src/helper.js.map +1 -1
  11. package/dist/cjs/src/index.js +11 -5
  12. package/dist/cjs/src/index.js.map +1 -1
  13. package/dist/cjs/src/schema.js +1 -0
  14. package/dist/cjs/src/schema.js.map +1 -1
  15. package/dist/esm/__tests__/font.test.js +194 -28
  16. package/dist/esm/__tests__/font.test.js.map +1 -1
  17. package/dist/esm/__tests__/helper.test.js +16 -1
  18. package/dist/esm/__tests__/helper.test.js.map +1 -1
  19. package/dist/esm/src/constants.js +7 -4
  20. package/dist/esm/src/constants.js.map +1 -1
  21. package/dist/esm/src/font.js +145 -38
  22. package/dist/esm/src/font.js.map +1 -1
  23. package/dist/esm/src/helper.js +8 -1
  24. package/dist/esm/src/helper.js.map +1 -1
  25. package/dist/esm/src/index.js +4 -4
  26. package/dist/esm/src/index.js.map +1 -1
  27. package/dist/esm/src/schema.js +1 -0
  28. package/dist/esm/src/schema.js.map +1 -1
  29. package/dist/types/src/constants.d.ts +7 -4
  30. package/dist/types/src/font.d.ts +20 -1
  31. package/dist/types/src/helper.d.ts +2 -0
  32. package/dist/types/src/index.d.ts +5 -5
  33. package/dist/types/src/schema.d.ts +94 -0
  34. package/dist/types/src/type.d.ts +1 -0
  35. package/package.json +1 -1
  36. package/src/constants.ts +7 -4
  37. package/src/font.ts +195 -63
  38. package/src/helper.ts +10 -1
  39. package/src/index.ts +24 -9
  40. package/src/schema.ts +1 -0
@@ -74,12 +74,15 @@ export declare const TextSchema: z.ZodObject<{
74
74
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
75
75
  max: z.ZodNumber;
76
76
  min: z.ZodNumber;
77
+ fit: z.ZodOptional<z.ZodString>;
77
78
  }, "strip", z.ZodTypeAny, {
78
79
  max: number;
79
80
  min: number;
81
+ fit?: string | undefined;
80
82
  }, {
81
83
  max: number;
82
84
  min: number;
85
+ fit?: string | undefined;
83
86
  }>>;
84
87
  }, "strip", z.ZodTypeAny, {
85
88
  type: "text";
@@ -100,6 +103,7 @@ export declare const TextSchema: z.ZodObject<{
100
103
  dynamicFontSize?: {
101
104
  max: number;
102
105
  min: number;
106
+ fit?: string | undefined;
103
107
  } | undefined;
104
108
  }, {
105
109
  type: "text";
@@ -120,6 +124,7 @@ export declare const TextSchema: z.ZodObject<{
120
124
  dynamicFontSize?: {
121
125
  max: number;
122
126
  min: number;
127
+ fit?: string | undefined;
123
128
  } | undefined;
124
129
  }>;
125
130
  export declare const ImageSchema: z.ZodObject<{
@@ -215,12 +220,15 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
215
220
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
216
221
  max: z.ZodNumber;
217
222
  min: z.ZodNumber;
223
+ fit: z.ZodOptional<z.ZodString>;
218
224
  }, "strip", z.ZodTypeAny, {
219
225
  max: number;
220
226
  min: number;
227
+ fit?: string | undefined;
221
228
  }, {
222
229
  max: number;
223
230
  min: number;
231
+ fit?: string | undefined;
224
232
  }>>;
225
233
  }, "strip", z.ZodTypeAny, {
226
234
  type: "text";
@@ -241,6 +249,7 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
241
249
  dynamicFontSize?: {
242
250
  max: number;
243
251
  min: number;
252
+ fit?: string | undefined;
244
253
  } | undefined;
245
254
  }, {
246
255
  type: "text";
@@ -261,6 +270,7 @@ export declare const Schema: z.ZodUnion<[z.ZodObject<{
261
270
  dynamicFontSize?: {
262
271
  max: number;
263
272
  min: number;
273
+ fit?: string | undefined;
264
274
  } | undefined;
265
275
  }>, z.ZodObject<{
266
276
  height: z.ZodNumber;
@@ -354,12 +364,15 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
354
364
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
355
365
  max: z.ZodNumber;
356
366
  min: z.ZodNumber;
367
+ fit: z.ZodOptional<z.ZodString>;
357
368
  }, "strip", z.ZodTypeAny, {
358
369
  max: number;
359
370
  min: number;
371
+ fit?: string | undefined;
360
372
  }, {
361
373
  max: number;
362
374
  min: number;
375
+ fit?: string | undefined;
363
376
  }>>;
364
377
  id: z.ZodString;
365
378
  key: z.ZodString;
@@ -386,6 +399,7 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
386
399
  dynamicFontSize?: {
387
400
  max: number;
388
401
  min: number;
402
+ fit?: string | undefined;
389
403
  } | undefined;
390
404
  }, {
391
405
  type: "text";
@@ -409,6 +423,7 @@ export declare const SchemaForUI: z.ZodUnion<[z.ZodObject<{
409
423
  dynamicFontSize?: {
410
424
  max: number;
411
425
  min: number;
426
+ fit?: string | undefined;
412
427
  } | undefined;
413
428
  }>, z.ZodObject<{
414
429
  type: z.ZodLiteral<"image">;
@@ -535,12 +550,15 @@ export declare const Template: z.ZodObject<{
535
550
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
536
551
  max: z.ZodNumber;
537
552
  min: z.ZodNumber;
553
+ fit: z.ZodOptional<z.ZodString>;
538
554
  }, "strip", z.ZodTypeAny, {
539
555
  max: number;
540
556
  min: number;
557
+ fit?: string | undefined;
541
558
  }, {
542
559
  max: number;
543
560
  min: number;
561
+ fit?: string | undefined;
544
562
  }>>;
545
563
  }, "strip", z.ZodTypeAny, {
546
564
  type: "text";
@@ -561,6 +579,7 @@ export declare const Template: z.ZodObject<{
561
579
  dynamicFontSize?: {
562
580
  max: number;
563
581
  min: number;
582
+ fit?: string | undefined;
564
583
  } | undefined;
565
584
  }, {
566
585
  type: "text";
@@ -581,6 +600,7 @@ export declare const Template: z.ZodObject<{
581
600
  dynamicFontSize?: {
582
601
  max: number;
583
602
  min: number;
603
+ fit?: string | undefined;
584
604
  } | undefined;
585
605
  }>, z.ZodObject<{
586
606
  height: z.ZodNumber;
@@ -672,6 +692,7 @@ export declare const Template: z.ZodObject<{
672
692
  dynamicFontSize?: {
673
693
  max: number;
674
694
  min: number;
695
+ fit?: string | undefined;
675
696
  } | undefined;
676
697
  } | {
677
698
  type: "image";
@@ -715,6 +736,7 @@ export declare const Template: z.ZodObject<{
715
736
  dynamicFontSize?: {
716
737
  max: number;
717
738
  min: number;
739
+ fit?: string | undefined;
718
740
  } | undefined;
719
741
  } | {
720
742
  type: "image";
@@ -767,12 +789,15 @@ export declare const CommonProps: z.ZodObject<{
767
789
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
768
790
  max: z.ZodNumber;
769
791
  min: z.ZodNumber;
792
+ fit: z.ZodOptional<z.ZodString>;
770
793
  }, "strip", z.ZodTypeAny, {
771
794
  max: number;
772
795
  min: number;
796
+ fit?: string | undefined;
773
797
  }, {
774
798
  max: number;
775
799
  min: number;
800
+ fit?: string | undefined;
776
801
  }>>;
777
802
  }, "strip", z.ZodTypeAny, {
778
803
  type: "text";
@@ -793,6 +818,7 @@ export declare const CommonProps: z.ZodObject<{
793
818
  dynamicFontSize?: {
794
819
  max: number;
795
820
  min: number;
821
+ fit?: string | undefined;
796
822
  } | undefined;
797
823
  }, {
798
824
  type: "text";
@@ -813,6 +839,7 @@ export declare const CommonProps: z.ZodObject<{
813
839
  dynamicFontSize?: {
814
840
  max: number;
815
841
  min: number;
842
+ fit?: string | undefined;
816
843
  } | undefined;
817
844
  }>, z.ZodObject<{
818
845
  height: z.ZodNumber;
@@ -904,6 +931,7 @@ export declare const CommonProps: z.ZodObject<{
904
931
  dynamicFontSize?: {
905
932
  max: number;
906
933
  min: number;
934
+ fit?: string | undefined;
907
935
  } | undefined;
908
936
  } | {
909
937
  type: "image";
@@ -947,6 +975,7 @@ export declare const CommonProps: z.ZodObject<{
947
975
  dynamicFontSize?: {
948
976
  max: number;
949
977
  min: number;
978
+ fit?: string | undefined;
950
979
  } | undefined;
951
980
  } | {
952
981
  type: "image";
@@ -1019,6 +1048,7 @@ export declare const CommonProps: z.ZodObject<{
1019
1048
  dynamicFontSize?: {
1020
1049
  max: number;
1021
1050
  min: number;
1051
+ fit?: string | undefined;
1022
1052
  } | undefined;
1023
1053
  } | {
1024
1054
  type: "image";
@@ -1071,6 +1101,7 @@ export declare const CommonProps: z.ZodObject<{
1071
1101
  dynamicFontSize?: {
1072
1102
  max: number;
1073
1103
  min: number;
1104
+ fit?: string | undefined;
1074
1105
  } | undefined;
1075
1106
  } | {
1076
1107
  type: "image";
@@ -1157,12 +1188,15 @@ export declare const GenerateProps: z.ZodObject<{
1157
1188
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
1158
1189
  max: z.ZodNumber;
1159
1190
  min: z.ZodNumber;
1191
+ fit: z.ZodOptional<z.ZodString>;
1160
1192
  }, "strip", z.ZodTypeAny, {
1161
1193
  max: number;
1162
1194
  min: number;
1195
+ fit?: string | undefined;
1163
1196
  }, {
1164
1197
  max: number;
1165
1198
  min: number;
1199
+ fit?: string | undefined;
1166
1200
  }>>;
1167
1201
  }, "strip", z.ZodTypeAny, {
1168
1202
  type: "text";
@@ -1183,6 +1217,7 @@ export declare const GenerateProps: z.ZodObject<{
1183
1217
  dynamicFontSize?: {
1184
1218
  max: number;
1185
1219
  min: number;
1220
+ fit?: string | undefined;
1186
1221
  } | undefined;
1187
1222
  }, {
1188
1223
  type: "text";
@@ -1203,6 +1238,7 @@ export declare const GenerateProps: z.ZodObject<{
1203
1238
  dynamicFontSize?: {
1204
1239
  max: number;
1205
1240
  min: number;
1241
+ fit?: string | undefined;
1206
1242
  } | undefined;
1207
1243
  }>, z.ZodObject<{
1208
1244
  height: z.ZodNumber;
@@ -1294,6 +1330,7 @@ export declare const GenerateProps: z.ZodObject<{
1294
1330
  dynamicFontSize?: {
1295
1331
  max: number;
1296
1332
  min: number;
1333
+ fit?: string | undefined;
1297
1334
  } | undefined;
1298
1335
  } | {
1299
1336
  type: "image";
@@ -1337,6 +1374,7 @@ export declare const GenerateProps: z.ZodObject<{
1337
1374
  dynamicFontSize?: {
1338
1375
  max: number;
1339
1376
  min: number;
1377
+ fit?: string | undefined;
1340
1378
  } | undefined;
1341
1379
  } | {
1342
1380
  type: "image";
@@ -1410,6 +1448,7 @@ export declare const GenerateProps: z.ZodObject<{
1410
1448
  dynamicFontSize?: {
1411
1449
  max: number;
1412
1450
  min: number;
1451
+ fit?: string | undefined;
1413
1452
  } | undefined;
1414
1453
  } | {
1415
1454
  type: "image";
@@ -1463,6 +1502,7 @@ export declare const GenerateProps: z.ZodObject<{
1463
1502
  dynamicFontSize?: {
1464
1503
  max: number;
1465
1504
  min: number;
1505
+ fit?: string | undefined;
1466
1506
  } | undefined;
1467
1507
  } | {
1468
1508
  type: "image";
@@ -1554,12 +1594,15 @@ export declare const UIProps: z.ZodObject<{
1554
1594
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
1555
1595
  max: z.ZodNumber;
1556
1596
  min: z.ZodNumber;
1597
+ fit: z.ZodOptional<z.ZodString>;
1557
1598
  }, "strip", z.ZodTypeAny, {
1558
1599
  max: number;
1559
1600
  min: number;
1601
+ fit?: string | undefined;
1560
1602
  }, {
1561
1603
  max: number;
1562
1604
  min: number;
1605
+ fit?: string | undefined;
1563
1606
  }>>;
1564
1607
  }, "strip", z.ZodTypeAny, {
1565
1608
  type: "text";
@@ -1580,6 +1623,7 @@ export declare const UIProps: z.ZodObject<{
1580
1623
  dynamicFontSize?: {
1581
1624
  max: number;
1582
1625
  min: number;
1626
+ fit?: string | undefined;
1583
1627
  } | undefined;
1584
1628
  }, {
1585
1629
  type: "text";
@@ -1600,6 +1644,7 @@ export declare const UIProps: z.ZodObject<{
1600
1644
  dynamicFontSize?: {
1601
1645
  max: number;
1602
1646
  min: number;
1647
+ fit?: string | undefined;
1603
1648
  } | undefined;
1604
1649
  }>, z.ZodObject<{
1605
1650
  height: z.ZodNumber;
@@ -1691,6 +1736,7 @@ export declare const UIProps: z.ZodObject<{
1691
1736
  dynamicFontSize?: {
1692
1737
  max: number;
1693
1738
  min: number;
1739
+ fit?: string | undefined;
1694
1740
  } | undefined;
1695
1741
  } | {
1696
1742
  type: "image";
@@ -1734,6 +1780,7 @@ export declare const UIProps: z.ZodObject<{
1734
1780
  dynamicFontSize?: {
1735
1781
  max: number;
1736
1782
  min: number;
1783
+ fit?: string | undefined;
1737
1784
  } | undefined;
1738
1785
  } | {
1739
1786
  type: "image";
@@ -1810,6 +1857,7 @@ export declare const UIProps: z.ZodObject<{
1810
1857
  dynamicFontSize?: {
1811
1858
  max: number;
1812
1859
  min: number;
1860
+ fit?: string | undefined;
1813
1861
  } | undefined;
1814
1862
  } | {
1815
1863
  type: "image";
@@ -1864,6 +1912,7 @@ export declare const UIProps: z.ZodObject<{
1864
1912
  dynamicFontSize?: {
1865
1913
  max: number;
1866
1914
  min: number;
1915
+ fit?: string | undefined;
1867
1916
  } | undefined;
1868
1917
  } | {
1869
1918
  type: "image";
@@ -1925,12 +1974,15 @@ export declare const PreviewProps: z.ZodObject<{
1925
1974
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
1926
1975
  max: z.ZodNumber;
1927
1976
  min: z.ZodNumber;
1977
+ fit: z.ZodOptional<z.ZodString>;
1928
1978
  }, "strip", z.ZodTypeAny, {
1929
1979
  max: number;
1930
1980
  min: number;
1981
+ fit?: string | undefined;
1931
1982
  }, {
1932
1983
  max: number;
1933
1984
  min: number;
1985
+ fit?: string | undefined;
1934
1986
  }>>;
1935
1987
  }, "strip", z.ZodTypeAny, {
1936
1988
  type: "text";
@@ -1951,6 +2003,7 @@ export declare const PreviewProps: z.ZodObject<{
1951
2003
  dynamicFontSize?: {
1952
2004
  max: number;
1953
2005
  min: number;
2006
+ fit?: string | undefined;
1954
2007
  } | undefined;
1955
2008
  }, {
1956
2009
  type: "text";
@@ -1971,6 +2024,7 @@ export declare const PreviewProps: z.ZodObject<{
1971
2024
  dynamicFontSize?: {
1972
2025
  max: number;
1973
2026
  min: number;
2027
+ fit?: string | undefined;
1974
2028
  } | undefined;
1975
2029
  }>, z.ZodObject<{
1976
2030
  height: z.ZodNumber;
@@ -2062,6 +2116,7 @@ export declare const PreviewProps: z.ZodObject<{
2062
2116
  dynamicFontSize?: {
2063
2117
  max: number;
2064
2118
  min: number;
2119
+ fit?: string | undefined;
2065
2120
  } | undefined;
2066
2121
  } | {
2067
2122
  type: "image";
@@ -2105,6 +2160,7 @@ export declare const PreviewProps: z.ZodObject<{
2105
2160
  dynamicFontSize?: {
2106
2161
  max: number;
2107
2162
  min: number;
2163
+ fit?: string | undefined;
2108
2164
  } | undefined;
2109
2165
  } | {
2110
2166
  type: "image";
@@ -2182,6 +2238,7 @@ export declare const PreviewProps: z.ZodObject<{
2182
2238
  dynamicFontSize?: {
2183
2239
  max: number;
2184
2240
  min: number;
2241
+ fit?: string | undefined;
2185
2242
  } | undefined;
2186
2243
  } | {
2187
2244
  type: "image";
@@ -2237,6 +2294,7 @@ export declare const PreviewProps: z.ZodObject<{
2237
2294
  dynamicFontSize?: {
2238
2295
  max: number;
2239
2296
  min: number;
2297
+ fit?: string | undefined;
2240
2298
  } | undefined;
2241
2299
  } | {
2242
2300
  type: "image";
@@ -2299,12 +2357,15 @@ export declare const PreviewReactProps: z.ZodObject<{
2299
2357
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
2300
2358
  max: z.ZodNumber;
2301
2359
  min: z.ZodNumber;
2360
+ fit: z.ZodOptional<z.ZodString>;
2302
2361
  }, "strip", z.ZodTypeAny, {
2303
2362
  max: number;
2304
2363
  min: number;
2364
+ fit?: string | undefined;
2305
2365
  }, {
2306
2366
  max: number;
2307
2367
  min: number;
2368
+ fit?: string | undefined;
2308
2369
  }>>;
2309
2370
  }, "strip", z.ZodTypeAny, {
2310
2371
  type: "text";
@@ -2325,6 +2386,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2325
2386
  dynamicFontSize?: {
2326
2387
  max: number;
2327
2388
  min: number;
2389
+ fit?: string | undefined;
2328
2390
  } | undefined;
2329
2391
  }, {
2330
2392
  type: "text";
@@ -2345,6 +2407,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2345
2407
  dynamicFontSize?: {
2346
2408
  max: number;
2347
2409
  min: number;
2410
+ fit?: string | undefined;
2348
2411
  } | undefined;
2349
2412
  }>, z.ZodObject<{
2350
2413
  height: z.ZodNumber;
@@ -2436,6 +2499,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2436
2499
  dynamicFontSize?: {
2437
2500
  max: number;
2438
2501
  min: number;
2502
+ fit?: string | undefined;
2439
2503
  } | undefined;
2440
2504
  } | {
2441
2505
  type: "image";
@@ -2479,6 +2543,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2479
2543
  dynamicFontSize?: {
2480
2544
  max: number;
2481
2545
  min: number;
2546
+ fit?: string | undefined;
2482
2547
  } | undefined;
2483
2548
  } | {
2484
2549
  type: "image";
@@ -2578,6 +2643,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2578
2643
  dynamicFontSize?: {
2579
2644
  max: number;
2580
2645
  min: number;
2646
+ fit?: string | undefined;
2581
2647
  } | undefined;
2582
2648
  } | {
2583
2649
  type: "image";
@@ -2641,6 +2707,7 @@ export declare const PreviewReactProps: z.ZodObject<{
2641
2707
  dynamicFontSize?: {
2642
2708
  max: number;
2643
2709
  min: number;
2710
+ fit?: string | undefined;
2644
2711
  } | undefined;
2645
2712
  } | {
2646
2713
  type: "image";
@@ -2711,12 +2778,15 @@ export declare const DesignerProps: z.ZodObject<{
2711
2778
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
2712
2779
  max: z.ZodNumber;
2713
2780
  min: z.ZodNumber;
2781
+ fit: z.ZodOptional<z.ZodString>;
2714
2782
  }, "strip", z.ZodTypeAny, {
2715
2783
  max: number;
2716
2784
  min: number;
2785
+ fit?: string | undefined;
2717
2786
  }, {
2718
2787
  max: number;
2719
2788
  min: number;
2789
+ fit?: string | undefined;
2720
2790
  }>>;
2721
2791
  }, "strip", z.ZodTypeAny, {
2722
2792
  type: "text";
@@ -2737,6 +2807,7 @@ export declare const DesignerProps: z.ZodObject<{
2737
2807
  dynamicFontSize?: {
2738
2808
  max: number;
2739
2809
  min: number;
2810
+ fit?: string | undefined;
2740
2811
  } | undefined;
2741
2812
  }, {
2742
2813
  type: "text";
@@ -2757,6 +2828,7 @@ export declare const DesignerProps: z.ZodObject<{
2757
2828
  dynamicFontSize?: {
2758
2829
  max: number;
2759
2830
  min: number;
2831
+ fit?: string | undefined;
2760
2832
  } | undefined;
2761
2833
  }>, z.ZodObject<{
2762
2834
  height: z.ZodNumber;
@@ -2848,6 +2920,7 @@ export declare const DesignerProps: z.ZodObject<{
2848
2920
  dynamicFontSize?: {
2849
2921
  max: number;
2850
2922
  min: number;
2923
+ fit?: string | undefined;
2851
2924
  } | undefined;
2852
2925
  } | {
2853
2926
  type: "image";
@@ -2891,6 +2964,7 @@ export declare const DesignerProps: z.ZodObject<{
2891
2964
  dynamicFontSize?: {
2892
2965
  max: number;
2893
2966
  min: number;
2967
+ fit?: string | undefined;
2894
2968
  } | undefined;
2895
2969
  } | {
2896
2970
  type: "image";
@@ -2967,6 +3041,7 @@ export declare const DesignerProps: z.ZodObject<{
2967
3041
  dynamicFontSize?: {
2968
3042
  max: number;
2969
3043
  min: number;
3044
+ fit?: string | undefined;
2970
3045
  } | undefined;
2971
3046
  } | {
2972
3047
  type: "image";
@@ -3021,6 +3096,7 @@ export declare const DesignerProps: z.ZodObject<{
3021
3096
  dynamicFontSize?: {
3022
3097
  max: number;
3023
3098
  min: number;
3099
+ fit?: string | undefined;
3024
3100
  } | undefined;
3025
3101
  } | {
3026
3102
  type: "image";
@@ -3082,12 +3158,15 @@ export declare const DesignerReactProps: z.ZodObject<{
3082
3158
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
3083
3159
  max: z.ZodNumber;
3084
3160
  min: z.ZodNumber;
3161
+ fit: z.ZodOptional<z.ZodString>;
3085
3162
  }, "strip", z.ZodTypeAny, {
3086
3163
  max: number;
3087
3164
  min: number;
3165
+ fit?: string | undefined;
3088
3166
  }, {
3089
3167
  max: number;
3090
3168
  min: number;
3169
+ fit?: string | undefined;
3091
3170
  }>>;
3092
3171
  }, "strip", z.ZodTypeAny, {
3093
3172
  type: "text";
@@ -3108,6 +3187,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3108
3187
  dynamicFontSize?: {
3109
3188
  max: number;
3110
3189
  min: number;
3190
+ fit?: string | undefined;
3111
3191
  } | undefined;
3112
3192
  }, {
3113
3193
  type: "text";
@@ -3128,6 +3208,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3128
3208
  dynamicFontSize?: {
3129
3209
  max: number;
3130
3210
  min: number;
3211
+ fit?: string | undefined;
3131
3212
  } | undefined;
3132
3213
  }>, z.ZodObject<{
3133
3214
  height: z.ZodNumber;
@@ -3219,6 +3300,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3219
3300
  dynamicFontSize?: {
3220
3301
  max: number;
3221
3302
  min: number;
3303
+ fit?: string | undefined;
3222
3304
  } | undefined;
3223
3305
  } | {
3224
3306
  type: "image";
@@ -3262,6 +3344,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3262
3344
  dynamicFontSize?: {
3263
3345
  max: number;
3264
3346
  min: number;
3347
+ fit?: string | undefined;
3265
3348
  } | undefined;
3266
3349
  } | {
3267
3350
  type: "image";
@@ -3342,12 +3425,15 @@ export declare const DesignerReactProps: z.ZodObject<{
3342
3425
  dynamicFontSize: z.ZodOptional<z.ZodObject<{
3343
3426
  max: z.ZodNumber;
3344
3427
  min: z.ZodNumber;
3428
+ fit: z.ZodOptional<z.ZodString>;
3345
3429
  }, "strip", z.ZodTypeAny, {
3346
3430
  max: number;
3347
3431
  min: number;
3432
+ fit?: string | undefined;
3348
3433
  }, {
3349
3434
  max: number;
3350
3435
  min: number;
3436
+ fit?: string | undefined;
3351
3437
  }>>;
3352
3438
  }, "strip", z.ZodTypeAny, {
3353
3439
  type: "text";
@@ -3368,6 +3454,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3368
3454
  dynamicFontSize?: {
3369
3455
  max: number;
3370
3456
  min: number;
3457
+ fit?: string | undefined;
3371
3458
  } | undefined;
3372
3459
  }, {
3373
3460
  type: "text";
@@ -3388,6 +3475,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3388
3475
  dynamicFontSize?: {
3389
3476
  max: number;
3390
3477
  min: number;
3478
+ fit?: string | undefined;
3391
3479
  } | undefined;
3392
3480
  }>, z.ZodObject<{
3393
3481
  height: z.ZodNumber;
@@ -3479,6 +3567,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3479
3567
  dynamicFontSize?: {
3480
3568
  max: number;
3481
3569
  min: number;
3570
+ fit?: string | undefined;
3482
3571
  } | undefined;
3483
3572
  } | {
3484
3573
  type: "image";
@@ -3522,6 +3611,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3522
3611
  dynamicFontSize?: {
3523
3612
  max: number;
3524
3613
  min: number;
3614
+ fit?: string | undefined;
3525
3615
  } | undefined;
3526
3616
  } | {
3527
3617
  type: "image";
@@ -3577,6 +3667,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3577
3667
  dynamicFontSize?: {
3578
3668
  max: number;
3579
3669
  min: number;
3670
+ fit?: string | undefined;
3580
3671
  } | undefined;
3581
3672
  } | {
3582
3673
  type: "image";
@@ -3625,6 +3716,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3625
3716
  dynamicFontSize?: {
3626
3717
  max: number;
3627
3718
  min: number;
3719
+ fit?: string | undefined;
3628
3720
  } | undefined;
3629
3721
  } | {
3630
3722
  type: "image";
@@ -3678,6 +3770,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3678
3770
  dynamicFontSize?: {
3679
3771
  max: number;
3680
3772
  min: number;
3773
+ fit?: string | undefined;
3681
3774
  } | undefined;
3682
3775
  } | {
3683
3776
  type: "image";
@@ -3726,6 +3819,7 @@ export declare const DesignerReactProps: z.ZodObject<{
3726
3819
  dynamicFontSize?: {
3727
3820
  max: number;
3728
3821
  min: number;
3822
+ fit?: string | undefined;
3729
3823
  } | undefined;
3730
3824
  } | {
3731
3825
  type: "image";
@@ -21,6 +21,7 @@ export declare const isTextSchema: (arg: CommonSchema) => arg is {
21
21
  dynamicFontSize?: {
22
22
  max: number;
23
23
  min: number;
24
+ fit?: string | undefined;
24
25
  } | undefined;
25
26
  };
26
27
  export declare const isImageSchema: (arg: CommonSchema) => arg is {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
package/src/constants.ts CHANGED
@@ -4,10 +4,13 @@ export const DEFAULT_ALIGNMENT = 'left';
4
4
  export const DEFAULT_LINE_HEIGHT = 1;
5
5
  export const DEFAULT_CHARACTER_SPACING = 0;
6
6
  export const DEFAULT_FONT_COLOR = '#000';
7
- export const DEFAULT_TOLERANCE = 1;
8
- export const DEFAULT_FONT_SIZE_ADJUSTMENT = 0.25;
9
- export const DEFAULT_PT_TO_PX_RATIO = 1.333;
10
- export const DEFAULT_PT_TO_MM_RATIO = 0.3528;
7
+ export const DYNAMIC_FIT_VERTICAL = 'vertical';
8
+ export const DYNAMIC_FIT_HORIZONTAL = 'horizontal';
9
+ export const DEFAULT_DYNAMIC_FIT = DYNAMIC_FIT_VERTICAL;
10
+ export const FONT_SIZE_ADJUSTMENT = 0.25;
11
+ export const PT_TO_PX_RATIO = 1.333;
12
+ export const PT_TO_MM_RATIO = 0.3528;
13
+ export const MM_TO_PT_RATIO = 2.8346; // https://www.ddc.co.jp/words/archives/20090701114500.html
11
14
 
12
15
  export const BLANK_PDF =
13
16
  'data:application/pdf;base64,JVBERi0xLjcKJeLjz9MKNSAwIG9iago8PAovRmlsdGVyIC9GbGF0ZURlY29kZQovTGVuZ3RoIDM4Cj4+CnN0cmVhbQp4nCvkMlAwUDC1NNUzMVGwMDHUszRSKErlCtfiyuMK5AIAXQ8GCgplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL01lZGlhQm94IFswIDAgNTk1LjQ0IDg0MS45Ml0KL1Jlc291cmNlcyA8PAo+PgovQ29udGVudHMgNSAwIFIKL1BhcmVudCAyIDAgUgo+PgplbmRvYmoKMiAwIG9iago8PAovVHlwZSAvUGFnZXMKL0tpZHMgWzQgMCBSXQovQ291bnQgMQo+PgplbmRvYmoKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL3RyYXBwZWQgKGZhbHNlKQovQ3JlYXRvciAoU2VyaWYgQWZmaW5pdHkgRGVzaWduZXIgMS4xMC40KQovVGl0bGUgKFVudGl0bGVkLnBkZikKL0NyZWF0aW9uRGF0ZSAoRDoyMDIyMDEwNjE0MDg1OCswOScwMCcpCi9Qcm9kdWNlciAoaUxvdmVQREYpCi9Nb2REYXRlIChEOjIwMjIwMTA2MDUwOTA5WikKPj4KZW5kb2JqCjYgMCBvYmoKPDwKL1NpemUgNwovUm9vdCAxIDAgUgovSW5mbyAzIDAgUgovSUQgWzwyODhCM0VENTAyOEU0MDcyNERBNzNCOUE0Nzk4OUEwQT4gPEY1RkJGNjg4NkVERDZBQUNBNDRCNEZDRjBBRDUxRDlDPl0KL1R5cGUgL1hSZWYKL1cgWzEgMiAyXQovRmlsdGVyIC9GbGF0ZURlY29kZQovSW5kZXggWzAgN10KL0xlbmd0aCAzNgo+PgpzdHJlYW0KeJxjYGD4/5+RUZmBgZHhFZBgDAGxakAEP5BgEmFgAABlRwQJCmVuZHN0cmVhbQplbmRvYmoKc3RhcnR4cmVmCjUzMgolJUVPRgo=';