@pdfme/common 1.0.0-beta.3 → 1.0.0-beta.7

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.
@@ -1,4 +1,6 @@
1
1
  import { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, BLANK_PDF } from './constants';
2
- import { Lang, Size, Alignment, SchemaType, schemaTypes, BarCodeType, TextSchema, isTextSchema, ImageSchema, isImageSchema, BarcodeSchema, isBarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps } from './type';
2
+ import { schemaTypes, isImageSchema, isBarcodeSchema, isTextSchema } from './type';
3
+ import type { Lang, Size, Alignment, SchemaType, BarCodeType, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps } from './type';
3
4
  import { getB64BasePdf, b64toUint8Array, getFallbackFontName, getDefaultFont, checkFont, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput } from './helper';
4
- export { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, BLANK_PDF, Lang, Size, Alignment, SchemaType, schemaTypes, BarCodeType, TextSchema, isTextSchema, ImageSchema, isImageSchema, BarcodeSchema, isBarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps, getB64BasePdf, b64toUint8Array, getFallbackFontName, getDefaultFont, checkFont, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, };
5
+ export { DEFAULT_FONT_SIZE, DEFAULT_ALIGNMENT, DEFAULT_LINE_HEIGHT, DEFAULT_CHARACTER_SPACING, DEFAULT_FONT_COLOR, BLANK_PDF, schemaTypes, isTextSchema, isImageSchema, isBarcodeSchema, getB64BasePdf, b64toUint8Array, getFallbackFontName, getDefaultFont, checkFont, checkTemplate, checkUIProps, checkPreviewProps, checkDesignerProps, checkGenerateProps, validateBarcodeInput, };
6
+ export type { Lang, Size, Alignment, SchemaType, BarCodeType, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps, };
@@ -2149,8 +2149,8 @@ export declare const PreviewProps: z.ZodObject<z.extendShape<z.extendShape<{
2149
2149
  }>[];
2150
2150
  basePdf: string | ArrayBuffer | Uint8Array;
2151
2151
  };
2152
- inputs: Record<string, string>[];
2153
2152
  domContainer: HTMLElement;
2153
+ inputs: Record<string, string>[];
2154
2154
  }, {
2155
2155
  options?: {
2156
2156
  font?: Record<string, {
@@ -2200,8 +2200,8 @@ export declare const PreviewProps: z.ZodObject<z.extendShape<z.extendShape<{
2200
2200
  }>[];
2201
2201
  basePdf: string | ArrayBuffer | Uint8Array;
2202
2202
  };
2203
- inputs: Record<string, string>[];
2204
2203
  domContainer: HTMLElement;
2204
+ inputs: Record<string, string>[];
2205
2205
  }>;
2206
2206
  export declare const PreviewReactProps: z.ZodObject<z.extendShape<{
2207
2207
  options: z.ZodOptional<z.ZodObject<z.extendShape<{
@@ -1,13 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { Lang, Size, Alignment, BarcodeSchemaType, SchemaType, CommonSchema as _CommonSchema, TextSchema, ImageSchema, BarcodeSchema, Schema, SchemaForUI, Font, BasePdf, Template, CommonProps, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, PreviewReactProps, DesignerProps, DesignerReactProps } from './schema';
3
- export declare type Lang = z.infer<typeof Lang>;
4
- export declare type Size = z.infer<typeof Size>;
5
- export declare type Alignment = z.infer<typeof Alignment>;
6
- export declare type SchemaType = z.infer<typeof SchemaType>;
7
- export declare const schemaTypes: readonly ["text", "image", "qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce"];
8
- export declare type BarCodeType = z.infer<typeof BarcodeSchemaType>;
9
- export declare type TextSchema = z.infer<typeof TextSchema>;
10
3
  declare type CommonSchema = z.infer<typeof _CommonSchema>;
4
+ export declare const schemaTypes: readonly ["text", "image", "qrcode", "japanpost", "ean13", "ean8", "code39", "code128", "nw7", "itf14", "upca", "upce"];
11
5
  export declare const isTextSchema: (arg: CommonSchema) => arg is {
12
6
  rotate?: number | undefined;
13
7
  alignment?: "left" | "center" | "right" | undefined;
@@ -25,7 +19,6 @@ export declare const isTextSchema: (arg: CommonSchema) => arg is {
25
19
  width: number;
26
20
  height: number;
27
21
  };
28
- export declare type ImageSchema = z.infer<typeof ImageSchema>;
29
22
  export declare const isImageSchema: (arg: CommonSchema) => arg is {
30
23
  rotate?: number | undefined;
31
24
  type: "image";
@@ -36,7 +29,6 @@ export declare const isImageSchema: (arg: CommonSchema) => arg is {
36
29
  width: number;
37
30
  height: number;
38
31
  };
39
- export declare type BarcodeSchema = z.infer<typeof BarcodeSchema>;
40
32
  export declare const isBarcodeSchema: (arg: CommonSchema) => arg is {
41
33
  rotate?: number | undefined;
42
34
  type: "qrcode" | "japanpost" | "ean13" | "ean8" | "code39" | "code128" | "nw7" | "itf14" | "upca" | "upce";
@@ -47,6 +39,14 @@ export declare const isBarcodeSchema: (arg: CommonSchema) => arg is {
47
39
  width: number;
48
40
  height: number;
49
41
  };
42
+ export declare type Lang = z.infer<typeof Lang>;
43
+ export declare type Size = z.infer<typeof Size>;
44
+ export declare type Alignment = z.infer<typeof Alignment>;
45
+ export declare type SchemaType = z.infer<typeof SchemaType>;
46
+ export declare type BarCodeType = z.infer<typeof BarcodeSchemaType>;
47
+ export declare type TextSchema = z.infer<typeof TextSchema>;
48
+ export declare type ImageSchema = z.infer<typeof ImageSchema>;
49
+ export declare type BarcodeSchema = z.infer<typeof BarcodeSchema>;
50
50
  export declare type Schema = z.infer<typeof Schema>;
51
51
  export declare type SchemaForUI = z.infer<typeof SchemaForUI>;
52
52
  export declare type Font = z.infer<typeof Font>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/common",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.7",
4
4
  "author": "hand-dot",
5
5
  "license": "MIT",
6
6
  "description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
@@ -10,6 +10,7 @@
10
10
  "url": "https://github.com/pdfme/pdfme/issues"
11
11
  },
12
12
  "main": "dist/index.js",
13
+ "module": "dist/index.js",
13
14
  "types": "dist/types/index.d.ts",
14
15
  "engines": {
15
16
  "node": ">=14"
@@ -46,5 +47,8 @@
46
47
  "testMatch": [
47
48
  "**/*.test.ts"
48
49
  ]
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
49
53
  }
50
- }
54
+ }
package/src/index.ts CHANGED
@@ -6,19 +6,16 @@ import {
6
6
  DEFAULT_FONT_COLOR,
7
7
  BLANK_PDF,
8
8
  } from './constants';
9
- import {
9
+ import { schemaTypes, isImageSchema, isBarcodeSchema, isTextSchema } from './type';
10
+ import type {
10
11
  Lang,
11
12
  Size,
12
13
  Alignment,
13
14
  SchemaType,
14
- schemaTypes,
15
15
  BarCodeType,
16
16
  TextSchema,
17
- isTextSchema,
18
17
  ImageSchema,
19
- isImageSchema,
20
18
  BarcodeSchema,
21
- isBarcodeSchema,
22
19
  Schema,
23
20
  SchemaForUI,
24
21
  Font,
@@ -55,18 +52,32 @@ export {
55
52
  DEFAULT_CHARACTER_SPACING,
56
53
  DEFAULT_FONT_COLOR,
57
54
  BLANK_PDF,
55
+ schemaTypes,
56
+ isTextSchema,
57
+ isImageSchema,
58
+ isBarcodeSchema,
59
+ getB64BasePdf,
60
+ b64toUint8Array,
61
+ getFallbackFontName,
62
+ getDefaultFont,
63
+ checkFont,
64
+ checkTemplate,
65
+ checkUIProps,
66
+ checkPreviewProps,
67
+ checkDesignerProps,
68
+ checkGenerateProps,
69
+ validateBarcodeInput,
70
+ };
71
+
72
+ export type {
58
73
  Lang,
59
74
  Size,
60
75
  Alignment,
61
76
  SchemaType,
62
- schemaTypes,
63
77
  BarCodeType,
64
78
  TextSchema,
65
- isTextSchema,
66
79
  ImageSchema,
67
- isImageSchema,
68
80
  BarcodeSchema,
69
- isBarcodeSchema,
70
81
  Schema,
71
82
  SchemaForUI,
72
83
  Font,
@@ -81,15 +92,4 @@ export {
81
92
  PreviewReactProps,
82
93
  DesignerProps,
83
94
  DesignerReactProps,
84
- getB64BasePdf,
85
- b64toUint8Array,
86
- getFallbackFontName,
87
- getDefaultFont,
88
- checkFont,
89
- checkTemplate,
90
- checkUIProps,
91
- checkPreviewProps,
92
- checkDesignerProps,
93
- checkGenerateProps,
94
- validateBarcodeInput,
95
95
  };
package/src/type.ts CHANGED
@@ -27,20 +27,21 @@ import {
27
27
  DesignerReactProps,
28
28
  } from './schema';
29
29
 
30
+ type CommonSchema = z.infer<typeof _CommonSchema>;
31
+ export const schemaTypes = _schemaTypes;
32
+ export const isTextSchema = (arg: CommonSchema): arg is TextSchema => arg.type === 'text';
33
+ export const isImageSchema = (arg: CommonSchema): arg is ImageSchema => arg.type === 'image';
34
+ export const isBarcodeSchema = (arg: CommonSchema): arg is BarcodeSchema =>
35
+ barcodeSchemaTypes.map((t) => t as string).includes(arg.type);
36
+
30
37
  export type Lang = z.infer<typeof Lang>;
31
38
  export type Size = z.infer<typeof Size>;
32
39
  export type Alignment = z.infer<typeof Alignment>;
33
40
  export type SchemaType = z.infer<typeof SchemaType>;
34
- export const schemaTypes = _schemaTypes;
35
41
  export type BarCodeType = z.infer<typeof BarcodeSchemaType>;
36
42
  export type TextSchema = z.infer<typeof TextSchema>;
37
- type CommonSchema = z.infer<typeof _CommonSchema>;
38
- export const isTextSchema = (arg: CommonSchema): arg is TextSchema => arg.type === 'text';
39
43
  export type ImageSchema = z.infer<typeof ImageSchema>;
40
- export const isImageSchema = (arg: CommonSchema): arg is ImageSchema => arg.type === 'image';
41
44
  export type BarcodeSchema = z.infer<typeof BarcodeSchema>;
42
- export const isBarcodeSchema = (arg: CommonSchema): arg is BarcodeSchema =>
43
- barcodeSchemaTypes.map((t) => t as string).includes(arg.type);
44
45
  export type Schema = z.infer<typeof Schema>;
45
46
  export type SchemaForUI = z.infer<typeof SchemaForUI>;
46
47
  export type Font = z.infer<typeof Font>;
package/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "noImplicitAny": true,
4
4
  "target": "es5",
5
5
  "esModuleInterop": true,
6
+ "isolatedModules": true,
6
7
  "declaration": true,
7
8
  "declarationDir": "dist/types",
8
9
  "module": "ES2015",
package/webpack.config.js CHANGED
@@ -33,7 +33,6 @@ const config = {
33
33
  output: {
34
34
  path: path.resolve(__dirname, 'dist'),
35
35
  filename: 'index.js',
36
- libraryTarget: 'umd',
37
36
  globalObject: 'this',
38
37
  library: {
39
38
  name: pkg.name,