@pdfme/common 6.1.13-dev.8 → 6.2.0-dev.13
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/dynamicTemplate.d.ts +8 -0
- package/dist/expression.d.ts +12 -1
- package/dist/helper.d.ts +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/index.js +44 -3
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +39 -15
- package/dist/types.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -2
package/dist/schema.d.ts
CHANGED
|
@@ -66,6 +66,19 @@ export declare const Dict: z.ZodObject<{
|
|
|
66
66
|
'schemas.middle': z.ZodString;
|
|
67
67
|
'schemas.bottom': z.ZodString;
|
|
68
68
|
'schemas.padding': z.ZodString;
|
|
69
|
+
'schemas.image.objectFit': z.ZodString;
|
|
70
|
+
'schemas.image.fit.contain': z.ZodString;
|
|
71
|
+
'schemas.image.fit.cover': z.ZodString;
|
|
72
|
+
'schemas.image.objectPosition': z.ZodString;
|
|
73
|
+
'schemas.image.position.left.top': z.ZodString;
|
|
74
|
+
'schemas.image.position.center.top': z.ZodString;
|
|
75
|
+
'schemas.image.position.right.top': z.ZodString;
|
|
76
|
+
'schemas.image.position.left.center': z.ZodString;
|
|
77
|
+
'schemas.image.position.center.center': z.ZodString;
|
|
78
|
+
'schemas.image.position.right.center': z.ZodString;
|
|
79
|
+
'schemas.image.position.left.bottom': z.ZodString;
|
|
80
|
+
'schemas.image.position.center.bottom': z.ZodString;
|
|
81
|
+
'schemas.image.position.right.bottom': z.ZodString;
|
|
69
82
|
'schemas.text.fontName': z.ZodString;
|
|
70
83
|
'schemas.text.size': z.ZodString;
|
|
71
84
|
'schemas.text.spacing': z.ZodString;
|
|
@@ -182,6 +195,17 @@ export declare const SchemaForUI: z.ZodObject<{
|
|
|
182
195
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
183
196
|
id: z.ZodString;
|
|
184
197
|
}, z.core.$strip>;
|
|
198
|
+
/**
|
|
199
|
+
* PDF / font bytes with a definite ArrayBuffer backing store.
|
|
200
|
+
*
|
|
201
|
+
* Printed by name in declaration emit so published .d.ts stays valid on
|
|
202
|
+
* TypeScript ≤5.6, where Uint8Array is not generic. A generic typed-array
|
|
203
|
+
* annotation poisons `z.infer` unions such as `Template['basePdf']` on
|
|
204
|
+
* those compilers (see #1021).
|
|
205
|
+
*/
|
|
206
|
+
export interface PdfBytes extends Uint8Array {
|
|
207
|
+
readonly buffer: ArrayBuffer;
|
|
208
|
+
}
|
|
185
209
|
export declare const BlankPdf: z.ZodObject<{
|
|
186
210
|
width: z.ZodNumber;
|
|
187
211
|
height: z.ZodNumber;
|
|
@@ -208,8 +232,8 @@ export declare const BlankPdf: z.ZodObject<{
|
|
|
208
232
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
209
233
|
}, z.core.$loose>>>;
|
|
210
234
|
}, z.core.$strip>;
|
|
211
|
-
export declare const CustomPdf: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
212
|
-
export declare const BasePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
235
|
+
export declare const CustomPdf: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
236
|
+
export declare const BasePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
213
237
|
width: z.ZodNumber;
|
|
214
238
|
height: z.ZodNumber;
|
|
215
239
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -299,7 +323,7 @@ export declare const Template: z.ZodObject<{
|
|
|
299
323
|
}, z.core.$strip>>;
|
|
300
324
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
301
325
|
}, z.core.$loose>>>;
|
|
302
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
326
|
+
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
303
327
|
width: z.ZodNumber;
|
|
304
328
|
height: z.ZodNumber;
|
|
305
329
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -329,7 +353,7 @@ export declare const Template: z.ZodObject<{
|
|
|
329
353
|
}, z.core.$loose>;
|
|
330
354
|
export declare const Inputs: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
331
355
|
export declare const Font: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
332
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
356
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
333
357
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
334
358
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
335
359
|
}, z.core.$strip>>;
|
|
@@ -365,14 +389,14 @@ export declare const Plugin: z.ZodObject<{
|
|
|
365
389
|
}, z.core.$loose>;
|
|
366
390
|
export declare const CommonOptions: z.ZodObject<{
|
|
367
391
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
368
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
392
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
369
393
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
370
394
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
371
395
|
}, z.core.$strip>>>;
|
|
372
396
|
}, z.core.$loose>;
|
|
373
397
|
export declare const GeneratorOptions: z.ZodObject<{
|
|
374
398
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
375
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
399
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
376
400
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
377
401
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
378
402
|
}, z.core.$strip>>>;
|
|
@@ -428,7 +452,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
428
452
|
}, z.core.$strip>>;
|
|
429
453
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
430
454
|
}, z.core.$loose>>>;
|
|
431
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
455
|
+
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
432
456
|
width: z.ZodNumber;
|
|
433
457
|
height: z.ZodNumber;
|
|
434
458
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -489,7 +513,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
489
513
|
inputs: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
490
514
|
options: z.ZodOptional<z.ZodObject<{
|
|
491
515
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
492
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
516
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
493
517
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
494
518
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
495
519
|
}, z.core.$strip>>>;
|
|
@@ -525,7 +549,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
525
549
|
}, z.core.$strict>;
|
|
526
550
|
export declare const UIOptions: z.ZodObject<{
|
|
527
551
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
528
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
552
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
529
553
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
530
554
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
531
555
|
}, z.core.$strip>>>;
|
|
@@ -575,7 +599,7 @@ export declare const UIProps: z.ZodObject<{
|
|
|
575
599
|
}, z.core.$strip>>;
|
|
576
600
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
577
601
|
}, z.core.$loose>>>;
|
|
578
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
602
|
+
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
579
603
|
width: z.ZodNumber;
|
|
580
604
|
height: z.ZodNumber;
|
|
581
605
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -636,7 +660,7 @@ export declare const UIProps: z.ZodObject<{
|
|
|
636
660
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
637
661
|
options: z.ZodOptional<z.ZodObject<{
|
|
638
662
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
639
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
663
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
640
664
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
641
665
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
642
666
|
}, z.core.$strip>>>;
|
|
@@ -687,7 +711,7 @@ export declare const PreviewProps: z.ZodObject<{
|
|
|
687
711
|
}, z.core.$strip>>;
|
|
688
712
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
689
713
|
}, z.core.$loose>>>;
|
|
690
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
714
|
+
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
691
715
|
width: z.ZodNumber;
|
|
692
716
|
height: z.ZodNumber;
|
|
693
717
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -748,7 +772,7 @@ export declare const PreviewProps: z.ZodObject<{
|
|
|
748
772
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
749
773
|
options: z.ZodOptional<z.ZodObject<{
|
|
750
774
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
751
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
775
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
752
776
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
753
777
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
754
778
|
}, z.core.$strip>>>;
|
|
@@ -800,7 +824,7 @@ export declare const DesignerProps: z.ZodObject<{
|
|
|
800
824
|
}, z.core.$strip>>;
|
|
801
825
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
802
826
|
}, z.core.$loose>>>;
|
|
803
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
827
|
+
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>, z.ZodObject<{
|
|
804
828
|
width: z.ZodNumber;
|
|
805
829
|
height: z.ZodNumber;
|
|
806
830
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -861,7 +885,7 @@ export declare const DesignerProps: z.ZodObject<{
|
|
|
861
885
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
862
886
|
options: z.ZodOptional<z.ZodObject<{
|
|
863
887
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
864
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
888
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
865
889
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
866
890
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
867
891
|
}, z.core.$strip>>>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { PDFPage, PDFDocument } from '@pdfme/pdf-lib';
|
|
3
3
|
import { Lang, Dict, Mode, Size, DynamicLayoutSplitRange, Schema, Font, SchemaForUI, BasePdf, BlankPdf, CustomPdf, CommonOptions, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps, ColorType, LegacySchemaPageArray, SchemaPageArray } from './schema.js';
|
|
4
|
+
export type { PdfBytes } from './schema.js';
|
|
4
5
|
export interface UIOptionsThemeToken {
|
|
5
6
|
colorPrimary?: string;
|
|
6
7
|
colorPrimaryBg?: string;
|
|
@@ -249,4 +250,3 @@ export type DynamicLayoutArgs = {
|
|
|
249
250
|
_cache: Map<string | number, unknown>;
|
|
250
251
|
};
|
|
251
252
|
export type GetDynamicLayout = (value: string, args: DynamicLayoutArgs) => Promise<DynamicLayoutCallbackResult>;
|
|
252
|
-
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PDFME_VERSION = "6.
|
|
1
|
+
export declare const PDFME_VERSION = "6.2.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0-dev.13",
|
|
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",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"clean": "rimraf dist",
|
|
46
46
|
"lint": "vp lint -c ../../.oxlintrc.json src",
|
|
47
47
|
"fmt": "vp fmt -c ../../.oxfmtrc.json src --write",
|
|
48
|
-
"test": "vitest run --config ../../vitest.config.ts"
|
|
48
|
+
"test": "vitest run --config ../../vitest.config.ts",
|
|
49
|
+
"test:types:consumer": "node ./scripts/test-types-consumer.mjs"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@pdfme/pdf-lib": "*",
|