@pdfme/common 6.1.13-dev.4 → 6.1.13-dev.46
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 +31 -2
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +33 -15
- package/dist/types.d.ts +1 -1
- package/package.json +3 -2
package/dist/schema.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const Lang: z.ZodEnum<{
|
|
|
10
10
|
ko: "ko";
|
|
11
11
|
pl: "pl";
|
|
12
12
|
th: "th";
|
|
13
|
+
tr: "tr";
|
|
13
14
|
zh: "zh";
|
|
14
15
|
"zh-TW": "zh-TW";
|
|
15
16
|
}>;
|
|
@@ -181,6 +182,17 @@ export declare const SchemaForUI: z.ZodObject<{
|
|
|
181
182
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
182
183
|
id: z.ZodString;
|
|
183
184
|
}, z.core.$strip>;
|
|
185
|
+
/**
|
|
186
|
+
* PDF / font bytes with a definite ArrayBuffer backing store.
|
|
187
|
+
*
|
|
188
|
+
* Printed by name in declaration emit so published .d.ts stays valid on
|
|
189
|
+
* TypeScript ≤5.6, where Uint8Array is not generic. A generic typed-array
|
|
190
|
+
* annotation poisons `z.infer` unions such as `Template['basePdf']` on
|
|
191
|
+
* those compilers (see #1021).
|
|
192
|
+
*/
|
|
193
|
+
export interface PdfBytes extends Uint8Array {
|
|
194
|
+
readonly buffer: ArrayBuffer;
|
|
195
|
+
}
|
|
184
196
|
export declare const BlankPdf: z.ZodObject<{
|
|
185
197
|
width: z.ZodNumber;
|
|
186
198
|
height: z.ZodNumber;
|
|
@@ -207,8 +219,8 @@ export declare const BlankPdf: z.ZodObject<{
|
|
|
207
219
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
208
220
|
}, z.core.$loose>>>;
|
|
209
221
|
}, z.core.$strip>;
|
|
210
|
-
export declare const CustomPdf: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
211
|
-
export declare const BasePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
222
|
+
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>>]>;
|
|
223
|
+
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<{
|
|
212
224
|
width: z.ZodNumber;
|
|
213
225
|
height: z.ZodNumber;
|
|
214
226
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -298,7 +310,7 @@ export declare const Template: z.ZodObject<{
|
|
|
298
310
|
}, z.core.$strip>>;
|
|
299
311
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
300
312
|
}, z.core.$loose>>>;
|
|
301
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
313
|
+
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<{
|
|
302
314
|
width: z.ZodNumber;
|
|
303
315
|
height: z.ZodNumber;
|
|
304
316
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -328,7 +340,7 @@ export declare const Template: z.ZodObject<{
|
|
|
328
340
|
}, z.core.$loose>;
|
|
329
341
|
export declare const Inputs: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
330
342
|
export declare const Font: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
331
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
343
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
332
344
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
333
345
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
334
346
|
}, z.core.$strip>>;
|
|
@@ -364,14 +376,14 @@ export declare const Plugin: z.ZodObject<{
|
|
|
364
376
|
}, z.core.$loose>;
|
|
365
377
|
export declare const CommonOptions: z.ZodObject<{
|
|
366
378
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
367
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
379
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
368
380
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
369
381
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
370
382
|
}, z.core.$strip>>>;
|
|
371
383
|
}, z.core.$loose>;
|
|
372
384
|
export declare const GeneratorOptions: z.ZodObject<{
|
|
373
385
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
374
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
386
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
375
387
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
376
388
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
377
389
|
}, z.core.$strip>>>;
|
|
@@ -395,6 +407,7 @@ export declare const GeneratorOptions: z.ZodObject<{
|
|
|
395
407
|
ko: "ko";
|
|
396
408
|
pl: "pl";
|
|
397
409
|
th: "th";
|
|
410
|
+
tr: "tr";
|
|
398
411
|
zh: "zh";
|
|
399
412
|
"zh-TW": "zh-TW";
|
|
400
413
|
}>>;
|
|
@@ -426,7 +439,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
426
439
|
}, z.core.$strip>>;
|
|
427
440
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
428
441
|
}, z.core.$loose>>>;
|
|
429
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
442
|
+
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<{
|
|
430
443
|
width: z.ZodNumber;
|
|
431
444
|
height: z.ZodNumber;
|
|
432
445
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -487,7 +500,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
487
500
|
inputs: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
488
501
|
options: z.ZodOptional<z.ZodObject<{
|
|
489
502
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
490
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
503
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
491
504
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
492
505
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
493
506
|
}, z.core.$strip>>>;
|
|
@@ -511,6 +524,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
511
524
|
ko: "ko";
|
|
512
525
|
pl: "pl";
|
|
513
526
|
th: "th";
|
|
527
|
+
tr: "tr";
|
|
514
528
|
zh: "zh";
|
|
515
529
|
"zh-TW": "zh-TW";
|
|
516
530
|
}>>;
|
|
@@ -522,7 +536,7 @@ export declare const GenerateProps: z.ZodObject<{
|
|
|
522
536
|
}, z.core.$strict>;
|
|
523
537
|
export declare const UIOptions: z.ZodObject<{
|
|
524
538
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
525
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
539
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
526
540
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
527
541
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
528
542
|
}, z.core.$strip>>>;
|
|
@@ -537,6 +551,7 @@ export declare const UIOptions: z.ZodObject<{
|
|
|
537
551
|
ko: "ko";
|
|
538
552
|
pl: "pl";
|
|
539
553
|
th: "th";
|
|
554
|
+
tr: "tr";
|
|
540
555
|
zh: "zh";
|
|
541
556
|
"zh-TW": "zh-TW";
|
|
542
557
|
}>>;
|
|
@@ -571,7 +586,7 @@ export declare const UIProps: z.ZodObject<{
|
|
|
571
586
|
}, z.core.$strip>>;
|
|
572
587
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
573
588
|
}, z.core.$loose>>>;
|
|
574
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
589
|
+
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<{
|
|
575
590
|
width: z.ZodNumber;
|
|
576
591
|
height: z.ZodNumber;
|
|
577
592
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -632,7 +647,7 @@ export declare const UIProps: z.ZodObject<{
|
|
|
632
647
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
633
648
|
options: z.ZodOptional<z.ZodObject<{
|
|
634
649
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
635
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
650
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
636
651
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
637
652
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
638
653
|
}, z.core.$strip>>>;
|
|
@@ -647,6 +662,7 @@ export declare const UIProps: z.ZodObject<{
|
|
|
647
662
|
ko: "ko";
|
|
648
663
|
pl: "pl";
|
|
649
664
|
th: "th";
|
|
665
|
+
tr: "tr";
|
|
650
666
|
zh: "zh";
|
|
651
667
|
"zh-TW": "zh-TW";
|
|
652
668
|
}>>;
|
|
@@ -682,7 +698,7 @@ export declare const PreviewProps: z.ZodObject<{
|
|
|
682
698
|
}, z.core.$strip>>;
|
|
683
699
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
684
700
|
}, z.core.$loose>>>;
|
|
685
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
701
|
+
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<{
|
|
686
702
|
width: z.ZodNumber;
|
|
687
703
|
height: z.ZodNumber;
|
|
688
704
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -743,7 +759,7 @@ export declare const PreviewProps: z.ZodObject<{
|
|
|
743
759
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
744
760
|
options: z.ZodOptional<z.ZodObject<{
|
|
745
761
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
746
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
762
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
747
763
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
748
764
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
749
765
|
}, z.core.$strip>>>;
|
|
@@ -758,6 +774,7 @@ export declare const PreviewProps: z.ZodObject<{
|
|
|
758
774
|
ko: "ko";
|
|
759
775
|
pl: "pl";
|
|
760
776
|
th: "th";
|
|
777
|
+
tr: "tr";
|
|
761
778
|
zh: "zh";
|
|
762
779
|
"zh-TW": "zh-TW";
|
|
763
780
|
}>>;
|
|
@@ -794,7 +811,7 @@ export declare const DesignerProps: z.ZodObject<{
|
|
|
794
811
|
}, z.core.$strip>>;
|
|
795
812
|
__isSplit: z.ZodOptional<z.ZodBoolean>;
|
|
796
813
|
}, z.core.$loose>>>;
|
|
797
|
-
basePdf: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
814
|
+
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<{
|
|
798
815
|
width: z.ZodNumber;
|
|
799
816
|
height: z.ZodNumber;
|
|
800
817
|
padding: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -855,7 +872,7 @@ export declare const DesignerProps: z.ZodObject<{
|
|
|
855
872
|
domContainer: z.ZodSchema<HTMLElement, unknown, z.core.$ZodTypeInternals<HTMLElement, unknown>>;
|
|
856
873
|
options: z.ZodOptional<z.ZodObject<{
|
|
857
874
|
font: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
858
|
-
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<
|
|
875
|
+
data: z.ZodUnion<readonly [z.ZodString, z.ZodSchema<ArrayBuffer, unknown, z.core.$ZodTypeInternals<ArrayBuffer, unknown>>, z.ZodSchema<PdfBytes, unknown, z.core.$ZodTypeInternals<PdfBytes, unknown>>]>;
|
|
859
876
|
fallback: z.ZodOptional<z.ZodBoolean>;
|
|
860
877
|
subset: z.ZodOptional<z.ZodBoolean>;
|
|
861
878
|
}, z.core.$strip>>>;
|
|
@@ -870,6 +887,7 @@ export declare const DesignerProps: z.ZodObject<{
|
|
|
870
887
|
ko: "ko";
|
|
871
888
|
pl: "pl";
|
|
872
889
|
th: "th";
|
|
890
|
+
tr: "tr";
|
|
873
891
|
zh: "zh";
|
|
874
892
|
"zh-TW": "zh-TW";
|
|
875
893
|
}>>;
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfme/common",
|
|
3
|
-
"version": "6.1.13-dev.
|
|
3
|
+
"version": "6.1.13-dev.46",
|
|
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": "*",
|