@connectedxm/zpl-generator 0.0.15 → 0.0.19

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.
@@ -4,6 +4,15 @@ export declare function generate(badge: Badge, data?: SourceData, overrides?: {
4
4
  [key: string]: string;
5
5
  }): string;
6
6
  export declare function getFieldValue(field: Field, data?: SourceData): string | undefined;
7
+ /**
8
+ * Counts how many lines the field data will occupy inside a ^FB field at
9
+ * a given font height. The field's own `fontHeight` is treated as the
10
+ * reference at which `measuredWidth` and `charsPerLine` were captured.
11
+ *
12
+ * Width scales linearly with height: at half the height, each glyph is
13
+ * roughly half as wide, so twice as many characters fit per line.
14
+ */
15
+ export declare function countLinesAtHeight(field: TextField, value: string, height: number): number;
7
16
  /**
8
17
  * Counts how many lines the field data will occupy inside a ^FB field.
9
18
  * Exported so consuming projects (e.g. React label previews) can reuse
@@ -15,3 +24,10 @@ export declare function getFieldValue(field: Field, data?: SourceData): string |
15
24
  * Otherwise falls back to a character-width heuristic using charsPerLine.
16
25
  */
17
26
  export declare function countLines(field: TextField, value: string): number;
27
+ /**
28
+ * Returns the largest font height ≤ `field.fontHeight` (and ≥
29
+ * `field.minFontHeight ?? 1`) at which the rendered text fits within
30
+ * `field.maxLines`. If even the minimum height cannot make the text fit,
31
+ * returns the minimum (text will overflow at the smallest allowed size).
32
+ */
33
+ export declare function calculateFittedFontHeight(field: TextField, value: string): number;
@@ -157,6 +157,17 @@ export declare const textAlignmentSchema: z.ZodEnum<{
157
157
  readonly Justified: "J";
158
158
  }>;
159
159
  export type TextAlignment = z.infer<typeof textAlignmentSchema>;
160
+ export declare const BarcodeAlignment: {
161
+ readonly Left: "L";
162
+ readonly Right: "R";
163
+ readonly Center: "C";
164
+ };
165
+ export declare const barcodeAlignmentSchema: z.ZodEnum<{
166
+ readonly Left: "L";
167
+ readonly Right: "R";
168
+ readonly Center: "C";
169
+ }>;
170
+ export type BarcodeAlignment = z.infer<typeof barcodeAlignmentSchema>;
160
171
  export declare const QRCodeErrorCorrection: {
161
172
  readonly Highest: "H";
162
173
  readonly High: "Q";
@@ -273,6 +284,7 @@ export declare const textFieldSchema: z.ZodObject<{
273
284
  }>;
274
285
  maxCharacters: z.ZodNumber;
275
286
  measuredWidth: z.ZodOptional<z.ZodNumber>;
287
+ minFontHeight: z.ZodOptional<z.ZodNumber>;
276
288
  }, z.core.$strip>;
277
289
  export type TextField = z.infer<typeof textFieldSchema>;
278
290
  export declare const barcodeFieldSchema: z.ZodObject<{
@@ -317,6 +329,11 @@ export declare const barcodeFieldSchema: z.ZodObject<{
317
329
  readonly Yes: "Y";
318
330
  readonly No: "N";
319
331
  }>;
332
+ alignment: z.ZodOptional<z.ZodEnum<{
333
+ readonly Left: "L";
334
+ readonly Right: "R";
335
+ readonly Center: "C";
336
+ }>>;
320
337
  }, z.core.$strip>;
321
338
  export type BarcodeField = z.infer<typeof barcodeFieldSchema>;
322
339
  export declare const qrcodeFieldSchema: z.ZodObject<{
@@ -427,6 +444,7 @@ export declare const fieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
427
444
  }>;
428
445
  maxCharacters: z.ZodNumber;
429
446
  measuredWidth: z.ZodOptional<z.ZodNumber>;
447
+ minFontHeight: z.ZodOptional<z.ZodNumber>;
430
448
  }, z.core.$strip>, z.ZodObject<{
431
449
  name: z.ZodString;
432
450
  x: z.ZodNumber;
@@ -469,6 +487,11 @@ export declare const fieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
469
487
  readonly Yes: "Y";
470
488
  readonly No: "N";
471
489
  }>;
490
+ alignment: z.ZodOptional<z.ZodEnum<{
491
+ readonly Left: "L";
492
+ readonly Right: "R";
493
+ readonly Center: "C";
494
+ }>>;
472
495
  }, z.core.$strip>, z.ZodObject<{
473
496
  name: z.ZodString;
474
497
  x: z.ZodNumber;
@@ -682,6 +705,7 @@ export declare const badgeSchema: z.ZodObject<{
682
705
  }>;
683
706
  maxCharacters: z.ZodNumber;
684
707
  measuredWidth: z.ZodOptional<z.ZodNumber>;
708
+ minFontHeight: z.ZodOptional<z.ZodNumber>;
685
709
  }, z.core.$strip>, z.ZodObject<{
686
710
  name: z.ZodString;
687
711
  x: z.ZodNumber;
@@ -724,6 +748,11 @@ export declare const badgeSchema: z.ZodObject<{
724
748
  readonly Yes: "Y";
725
749
  readonly No: "N";
726
750
  }>;
751
+ alignment: z.ZodOptional<z.ZodEnum<{
752
+ readonly Left: "L";
753
+ readonly Right: "R";
754
+ readonly Center: "C";
755
+ }>>;
727
756
  }, z.core.$strip>, z.ZodObject<{
728
757
  name: z.ZodString;
729
758
  x: z.ZodNumber;
@@ -864,6 +893,7 @@ export declare function validateBadge(data: Badge): z.ZodSafeParseResult<{
864
893
  transformation: "None" | "Uppercase" | "Lowercase" | "Capitalize";
865
894
  maxCharacters: number;
866
895
  measuredWidth?: number | undefined;
896
+ minFontHeight?: number | undefined;
867
897
  } | {
868
898
  name: string;
869
899
  x: number;
@@ -882,6 +912,7 @@ export declare function validateBadge(data: Badge): z.ZodSafeParseResult<{
882
912
  line: "N" | "Y";
883
913
  lineAbove: "N" | "Y";
884
914
  checkDigit: "N" | "Y";
915
+ alignment?: "R" | "C" | "L" | undefined;
885
916
  } | {
886
917
  name: string;
887
918
  x: number;
@@ -971,6 +1002,7 @@ export declare function validateBadgeOrThrow(data: Badge): {
971
1002
  transformation: "None" | "Uppercase" | "Lowercase" | "Capitalize";
972
1003
  maxCharacters: number;
973
1004
  measuredWidth?: number | undefined;
1005
+ minFontHeight?: number | undefined;
974
1006
  } | {
975
1007
  name: string;
976
1008
  x: number;
@@ -989,6 +1021,7 @@ export declare function validateBadgeOrThrow(data: Badge): {
989
1021
  line: "N" | "Y";
990
1022
  lineAbove: "N" | "Y";
991
1023
  checkDigit: "N" | "Y";
1024
+ alignment?: "R" | "C" | "L" | undefined;
992
1025
  } | {
993
1026
  name: string;
994
1027
  x: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/zpl-generator",
3
- "version": "0.0.15",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",