@connectedxm/zpl-generator 0.0.4-beta.4 → 0.0.4-beta.5
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/index.es.js +259 -259
- package/dist/src/generate.d.ts +3 -5
- package/dist/src/validate.d.ts +5 -0
- package/package.json +1 -1
package/dist/src/generate.d.ts
CHANGED
|
@@ -7,11 +7,9 @@ export declare function getFieldValue(field: Field, data?: SourceData): string |
|
|
|
7
7
|
* Exported so consuming projects (e.g. React label previews) can reuse
|
|
8
8
|
* the same logic to stay in sync with the generator.
|
|
9
9
|
*
|
|
10
|
-
* When
|
|
11
|
-
*
|
|
12
|
-
* new line is started. Explicit \& breaks always start a new line.
|
|
10
|
+
* When measuredWidth is provided (total rendered width in dots, as measured
|
|
11
|
+
* by the consumer), line count is estimated via ceil(measuredWidth / maxWidth).
|
|
13
12
|
*
|
|
14
|
-
*
|
|
15
|
-
* heuristic using fontHeight.
|
|
13
|
+
* Otherwise falls back to a character-width heuristic using charsPerLine.
|
|
16
14
|
*/
|
|
17
15
|
export declare function countLines(field: TextField, value: string): number;
|
package/dist/src/validate.d.ts
CHANGED
|
@@ -270,6 +270,7 @@ export declare const textFieldSchema: z.ZodObject<{
|
|
|
270
270
|
readonly Capitalize: "Capitalize";
|
|
271
271
|
}>;
|
|
272
272
|
maxCharacters: z.ZodNumber;
|
|
273
|
+
measuredWidth: z.ZodOptional<z.ZodNumber>;
|
|
273
274
|
}, z.core.$strip>;
|
|
274
275
|
export type TextField = z.infer<typeof textFieldSchema>;
|
|
275
276
|
export declare const barcodeFieldSchema: z.ZodObject<{
|
|
@@ -384,6 +385,7 @@ export declare const fieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
384
385
|
readonly Capitalize: "Capitalize";
|
|
385
386
|
}>;
|
|
386
387
|
maxCharacters: z.ZodNumber;
|
|
388
|
+
measuredWidth: z.ZodOptional<z.ZodNumber>;
|
|
387
389
|
}, z.core.$strip>, z.ZodObject<{
|
|
388
390
|
name: z.ZodString;
|
|
389
391
|
x: z.ZodNumber;
|
|
@@ -572,6 +574,7 @@ export declare const badgeSchema: z.ZodObject<{
|
|
|
572
574
|
readonly Capitalize: "Capitalize";
|
|
573
575
|
}>;
|
|
574
576
|
maxCharacters: z.ZodNumber;
|
|
577
|
+
measuredWidth: z.ZodOptional<z.ZodNumber>;
|
|
575
578
|
}, z.core.$strip>, z.ZodObject<{
|
|
576
579
|
name: z.ZodString;
|
|
577
580
|
x: z.ZodNumber;
|
|
@@ -702,6 +705,7 @@ export declare function validateBadge(data: Badge): z.ZodSafeParseResult<{
|
|
|
702
705
|
charsPerLine: number;
|
|
703
706
|
transformation: "None" | "Uppercase" | "Lowercase" | "Capitalize";
|
|
704
707
|
maxCharacters: number;
|
|
708
|
+
measuredWidth?: number | undefined;
|
|
705
709
|
} | {
|
|
706
710
|
name: string;
|
|
707
711
|
x: number;
|
|
@@ -787,6 +791,7 @@ export declare function validateBadgeOrThrow(data: Badge): {
|
|
|
787
791
|
charsPerLine: number;
|
|
788
792
|
transformation: "None" | "Uppercase" | "Lowercase" | "Capitalize";
|
|
789
793
|
maxCharacters: number;
|
|
794
|
+
measuredWidth?: number | undefined;
|
|
790
795
|
} | {
|
|
791
796
|
name: string;
|
|
792
797
|
x: number;
|