@segnavia/format 0.37.0 → 0.39.0

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.
Files changed (66) hide show
  1. package/dist/board-edit.d.ts +2 -1
  2. package/dist/board-geometry.d.ts +2 -1
  3. package/dist/board-section-grid.d.ts +2 -1
  4. package/dist/board-sections.d.ts +2 -1
  5. package/dist/board.d.ts +8 -8
  6. package/dist/board.js +15 -11
  7. package/dist/book-exports.d.ts +4 -0
  8. package/dist/book-section.d.ts +225 -3
  9. package/dist/book-section.js +82 -17
  10. package/dist/book.d.ts +878 -416
  11. package/dist/book.js +236 -37
  12. package/dist/cover.d.ts +337 -0
  13. package/dist/cover.js +100 -0
  14. package/dist/deck-from-slides.d.ts +23 -4
  15. package/dist/deck.d.ts +144 -42
  16. package/dist/deck.js +22 -24
  17. package/dist/dependency-policy.d.ts +12 -0
  18. package/dist/dependency-policy.js +42 -0
  19. package/dist/direction.d.ts +1 -1
  20. package/dist/font-collection.d.ts +8 -0
  21. package/dist/font-collection.js +191 -0
  22. package/dist/font-face.d.ts +8 -0
  23. package/dist/font-face.js +24 -0
  24. package/dist/font-refusal.d.ts +5 -0
  25. package/dist/font-refusal.js +9 -0
  26. package/dist/font-signature.d.ts +5 -0
  27. package/dist/font-signature.js +13 -0
  28. package/dist/fonts.d.ts +6 -1
  29. package/dist/fonts.js +3 -1
  30. package/dist/geometry.d.ts +20 -0
  31. package/dist/geometry.js +18 -0
  32. package/dist/image-fit.d.ts +10 -0
  33. package/dist/image-fit.js +10 -0
  34. package/dist/imposition-marks.d.ts +1 -1
  35. package/dist/imposition-schema.d.ts +185 -0
  36. package/dist/imposition-schema.js +122 -0
  37. package/dist/imposition.d.ts +8 -6
  38. package/dist/index.d.ts +29 -1797
  39. package/dist/index.js +30 -210
  40. package/dist/json-schemas.d.ts +1860 -0
  41. package/dist/json-schemas.js +43 -0
  42. package/dist/local-font-limits.d.ts +15 -0
  43. package/dist/local-font-limits.js +24 -0
  44. package/dist/media.d.ts +152 -0
  45. package/dist/media.js +119 -0
  46. package/dist/note-series.d.ts +70 -0
  47. package/dist/note-series.js +153 -0
  48. package/dist/page.d.ts +174 -0
  49. package/dist/page.js +37 -0
  50. package/dist/paper.d.ts +2 -1
  51. package/dist/paper.js +2 -1
  52. package/dist/placement-cycle.d.ts +5 -0
  53. package/dist/placement-cycle.js +30 -0
  54. package/dist/placement-refusal.d.ts +5 -0
  55. package/dist/placement-refusal.js +6 -0
  56. package/dist/placement.d.ts +76 -0
  57. package/dist/placement.js +100 -0
  58. package/dist/print.d.ts +72 -0
  59. package/dist/print.js +38 -0
  60. package/dist/printed-page-imposition.d.ts +2 -1
  61. package/dist/printed-pages.d.ts +14 -0
  62. package/dist/printed-pages.js +14 -1
  63. package/dist/shots-used.d.ts +0 -1
  64. package/dist/shots-used.js +2 -2
  65. package/dist/slots.d.ts +13 -13
  66. package/package.json +1 -1
@@ -0,0 +1,191 @@
1
+ import { FontFaceRefusedError } from "./font-refusal.js";
2
+ import { classifyFont } from "./font-signature.js";
3
+ //#region src/font-collection.ts
4
+ const MAX_COLLECTION_FACES = 64;
5
+ const MAX_FACE_TABLES = 64;
6
+ const MAX_FACE_NAME_RECORDS = 1024;
7
+ const MAX_FACE_NAME_BYTES = 1048576;
8
+ const CHECKSUM_MAGIC = 2981146554;
9
+ function tagAt(bytes, offset) {
10
+ return String.fromCharCode(bytes[offset] ?? 0, bytes[offset + 1] ?? 0, bytes[offset + 2] ?? 0, bytes[offset + 3] ?? 0);
11
+ }
12
+ function refuse(message, remedy) {
13
+ throw new FontFaceRefusedError(`${message}; ${remedy} to clear this refusal.`);
14
+ }
15
+ function malformedCollection(offset) {
16
+ refuse(`font collection header is malformed at byte ${offset}`, "supply a complete font collection");
17
+ }
18
+ function malformedFace(offset) {
19
+ refuse(`font face table directory is malformed at byte ${offset}`, "supply a complete supported font face");
20
+ }
21
+ function collectionView(bytes) {
22
+ return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
23
+ }
24
+ function requireCollectionRange(bytes, offset, length) {
25
+ const end = offset + length;
26
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || !Number.isSafeInteger(end) || offset < 0 || length < 0 || end > bytes.length) malformedCollection(Math.max(0, offset));
27
+ }
28
+ function requireFaceRange(bytes, offset, length) {
29
+ const end = offset + length;
30
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || !Number.isSafeInteger(end) || offset < 0 || length < 0 || end > bytes.length) malformedFace(Math.max(0, offset));
31
+ }
32
+ function collectionOffsets(bytes) {
33
+ requireCollectionRange(bytes, 0, 12);
34
+ if (tagAt(bytes, 0) !== "ttcf") malformedCollection(0);
35
+ const view = collectionView(bytes);
36
+ const version = view.getUint32(4);
37
+ if (version !== 65536 && version !== 131072) malformedCollection(4);
38
+ const count = view.getUint32(8);
39
+ if (count > MAX_COLLECTION_FACES) refuse(`font collection declares ${count} faces, above the limit ${MAX_COLLECTION_FACES}`, `supply a collection with at most ${MAX_COLLECTION_FACES} faces`);
40
+ requireCollectionRange(bytes, 12, count * 4);
41
+ const offsets = [];
42
+ for (let index = 0; index < count; index += 1) offsets.push(view.getUint32(12 + index * 4));
43
+ if (version === 131072) requireCollectionRange(bytes, 12 + count * 4, 12);
44
+ return offsets;
45
+ }
46
+ function sfntFormat(bytes, offset) {
47
+ requireFaceRange(bytes, offset, 4);
48
+ const format = classifyFont(bytes, offset);
49
+ if (format === "opentype" || format === "truetype") return format;
50
+ malformedFace(offset);
51
+ }
52
+ function faceTables(bytes, offset) {
53
+ requireFaceRange(bytes, offset, 12);
54
+ const view = collectionView(bytes);
55
+ const count = view.getUint16(offset + 4);
56
+ if (count > MAX_FACE_TABLES) refuse(`font face declares ${count} tables, above the limit ${MAX_FACE_TABLES}`, `supply a face with at most ${MAX_FACE_TABLES} tables`);
57
+ requireFaceRange(bytes, offset + 12, count * 16);
58
+ const tables = [];
59
+ for (let index = 0; index < count; index += 1) {
60
+ const record = offset + 12 + index * 16;
61
+ const table = {
62
+ tag: tagAt(bytes, record),
63
+ offset: view.getUint32(record + 8),
64
+ length: view.getUint32(record + 12)
65
+ };
66
+ const end = table.offset + table.length;
67
+ if (!Number.isSafeInteger(end) || end > bytes.length) refuse(`font table ${table.tag} lies outside the font file`, "supply table offsets and lengths within the font data");
68
+ tables.push(table);
69
+ }
70
+ const ordered = tables.filter((table) => table.length > 0).sort((left, right) => left.offset - right.offset);
71
+ for (let index = 1; index < ordered.length; index += 1) {
72
+ const previous = ordered[index - 1];
73
+ const table = ordered[index];
74
+ if (previous && table && table.offset < previous.offset + previous.length) refuse(`font table ${table.tag} overlaps font table ${previous.tag}`, "supply a face whose table byte ranges do not overlap");
75
+ }
76
+ return tables;
77
+ }
78
+ function decodeUtf16Be(bytes) {
79
+ let value = "";
80
+ for (let index = 0; index + 1 < bytes.length; index += 2) value += String.fromCharCode((bytes[index] ?? 0) * 256 + (bytes[index + 1] ?? 0));
81
+ return value;
82
+ }
83
+ function decodeMacRoman(bytes) {
84
+ return new TextDecoder("macintosh").decode(bytes);
85
+ }
86
+ function sfntPostScriptNames(bytes, faceOffset = 0) {
87
+ sfntFormat(bytes, faceOffset);
88
+ const name = faceTables(bytes, faceOffset).find((table) => table.tag === "name");
89
+ if (!name) return [];
90
+ if (name.length < 6) refuse("font table name lies outside the font file", "supply a complete name table");
91
+ requireFaceRange(bytes, name.offset, name.length);
92
+ const view = collectionView(bytes);
93
+ const count = view.getUint16(name.offset + 2);
94
+ if (count > MAX_FACE_NAME_RECORDS) refuse(`font name table declares ${count} records, above the limit ${MAX_FACE_NAME_RECORDS}`, `supply a face with at most ${MAX_FACE_NAME_RECORDS} name records`);
95
+ const strings = view.getUint16(name.offset + 4);
96
+ if (6 + count * 12 > name.length) refuse("font table name lies outside the font file", "supply a complete name table");
97
+ const records = /* @__PURE__ */ new Map();
98
+ let decodedBytes = 0;
99
+ for (let index = 0; index < count; index += 1) {
100
+ const record = name.offset + 6 + index * 12;
101
+ const platform = view.getUint16(record);
102
+ if (view.getUint16(record + 6) !== 6 || platform !== 1 && platform !== 3) continue;
103
+ const length = view.getUint16(record + 8);
104
+ const relative = view.getUint16(record + 10);
105
+ if (strings + relative + length > name.length) refuse("font table name lies outside the font file", "supply a complete name table");
106
+ const start = name.offset + strings + relative;
107
+ const key = `${platform}:${start}:${length}`;
108
+ if (records.has(key)) continue;
109
+ decodedBytes += length;
110
+ if (decodedBytes > MAX_FACE_NAME_BYTES) refuse(`font name table requires ${decodedBytes} decoded bytes, above the limit ${MAX_FACE_NAME_BYTES}`, `supply a face whose PostScript names occupy at most ${MAX_FACE_NAME_BYTES} bytes`);
111
+ records.set(key, {
112
+ platform,
113
+ start,
114
+ length
115
+ });
116
+ }
117
+ const names = [...records.values()].map(({ platform, start, length }) => {
118
+ const encoded = bytes.subarray(start, start + length);
119
+ return {
120
+ platform,
121
+ value: platform === 3 ? decodeUtf16Be(encoded) : decodeMacRoman(encoded)
122
+ };
123
+ });
124
+ const preferred = names.filter((name) => name.platform === 3);
125
+ return [...new Set((preferred.length > 0 ? preferred : names).map((name) => name.value))];
126
+ }
127
+ function collectionFaces(bytes) {
128
+ return collectionOffsets(bytes).flatMap((offset) => sfntPostScriptNames(bytes, offset));
129
+ }
130
+ function checksum(bytes, offset = 0, length = bytes.length) {
131
+ let sum = 0;
132
+ for (let index = 0; index < length; index += 4) {
133
+ const word = ((bytes[offset + index] ?? 0) << 24 | (bytes[offset + index + 1] ?? 0) << 16 | (bytes[offset + index + 2] ?? 0) << 8 | (bytes[offset + index + 3] ?? 0)) >>> 0;
134
+ sum = sum + word >>> 0;
135
+ }
136
+ return sum;
137
+ }
138
+ function directoryFields(count) {
139
+ const power = 2 ** Math.floor(Math.log2(Math.max(1, count)));
140
+ return {
141
+ searchRange: power * 16,
142
+ entrySelector: Math.log2(power),
143
+ rangeShift: count * 16 - power * 16
144
+ };
145
+ }
146
+ function extractAt(bytes, faceOffset) {
147
+ const format = sfntFormat(bytes, faceOffset);
148
+ const tables = faceTables(bytes, faceOffset).filter((table) => table.tag !== "DSIG");
149
+ const directoryLength = 12 + tables.length * 16;
150
+ let total = directoryLength;
151
+ for (const table of tables) total += Math.ceil(table.length / 4) * 4;
152
+ if (!Number.isSafeInteger(total) || total > bytes.length) refuse(`font face extraction requires ${total} bytes, above the font file size ${bytes.length}`, "supply a face whose table data fits within the font file");
153
+ const data = new Uint8Array(total);
154
+ const view = new DataView(data.buffer);
155
+ data.set(bytes.subarray(faceOffset, faceOffset + 4), 0);
156
+ view.setUint16(4, tables.length);
157
+ const fields = directoryFields(tables.length);
158
+ view.setUint16(6, fields.searchRange);
159
+ view.setUint16(8, fields.entrySelector);
160
+ view.setUint16(10, fields.rangeShift);
161
+ let outputOffset = directoryLength;
162
+ let headOffset;
163
+ for (let index = 0; index < tables.length; index += 1) {
164
+ const table = tables[index];
165
+ if (!table) continue;
166
+ const record = 12 + index * 16;
167
+ for (let byte = 0; byte < 4; byte += 1) data[record + byte] = table.tag.charCodeAt(byte);
168
+ data.set(bytes.subarray(table.offset, table.offset + table.length), outputOffset);
169
+ if (table.tag === "head") {
170
+ if (table.length < 12) refuse("font table head lies outside the font file", "supply a complete head table");
171
+ new DataView(data.buffer).setUint32(outputOffset + 8, 0);
172
+ headOffset = outputOffset;
173
+ }
174
+ view.setUint32(record + 4, checksum(data, outputOffset, table.length));
175
+ view.setUint32(record + 8, outputOffset);
176
+ view.setUint32(record + 12, table.length);
177
+ outputOffset += Math.ceil(table.length / 4) * 4;
178
+ }
179
+ if (headOffset !== void 0) view.setUint32(headOffset + 8, CHECKSUM_MAGIC - checksum(data) >>> 0);
180
+ return {
181
+ data,
182
+ format
183
+ };
184
+ }
185
+ function extractFace(bytes, postscriptName) {
186
+ const offsets = collectionOffsets(bytes);
187
+ for (const offset of offsets) if (sfntPostScriptNames(bytes, offset).includes(postscriptName)) return extractAt(bytes, offset);
188
+ refuse(`font collection has no face named ${postscriptName}; it holds ${collectionFaces(bytes).join(", ").slice(0, 1024) || "(none)"}`, "send the PostScript name of a face the collection holds");
189
+ }
190
+ //#endregion
191
+ export { collectionFaces, extractFace, sfntPostScriptNames };
@@ -0,0 +1,8 @@
1
+ import { FontFormat } from "./fonts.js";
2
+ //#region src/font-face.d.ts
3
+ export interface ResolvedFontFace {
4
+ data: Uint8Array;
5
+ format: Exclude<FontFormat, 'collection'>;
6
+ }
7
+ export declare function resolveFontFace(data: Uint8Array, format: FontFormat, postscriptName?: string): ResolvedFontFace;
8
+ //#endregion
@@ -0,0 +1,24 @@
1
+ import { FontFaceRefusedError } from "./font-refusal.js";
2
+ import { classifyFont } from "./font-signature.js";
3
+ import { collectionFaces, extractFace, sfntPostScriptNames } from "./font-collection.js";
4
+ //#region src/font-face.ts
5
+ function resolveFontFace(data, format, postscriptName) {
6
+ const detected = classifyFont(data);
7
+ if (detected === "collection") {
8
+ if (!postscriptName) throw new FontFaceRefusedError(`font collection requires a PostScript name; it holds ${collectionFaces(data).join(", ").slice(0, 1024) || "(none)"}; send one of those PostScript names to clear this refusal.`);
9
+ return extractFace(data, postscriptName);
10
+ }
11
+ if (format === "collection") throw new FontFaceRefusedError("font declared as a collection does not contain a font collection; send bytes with a ttcf signature to clear this refusal.");
12
+ if (!postscriptName || detected === "woff" || detected === "woff2") return {
13
+ data,
14
+ format
15
+ };
16
+ const names = sfntPostScriptNames(data);
17
+ if (names.includes(postscriptName) && (detected === "opentype" || detected === "truetype")) return {
18
+ data,
19
+ format: detected
20
+ };
21
+ throw new FontFaceRefusedError(`font face has PostScript name ${names.join(", ").slice(0, 1024) || "(none)"}, not ${postscriptName}; send its matching PostScript name to clear this refusal.`);
22
+ }
23
+ //#endregion
24
+ export { resolveFontFace };
@@ -0,0 +1,5 @@
1
+ //#region src/font-refusal.d.ts
2
+ export declare class FontFaceRefusedError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ //#endregion
@@ -0,0 +1,9 @@
1
+ //#region src/font-refusal.ts
2
+ var FontFaceRefusedError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "FontFaceRefusedError";
6
+ }
7
+ };
8
+ //#endregion
9
+ export { FontFaceRefusedError };
@@ -0,0 +1,5 @@
1
+ import { FontFormat } from "./fonts.js";
2
+ //#region src/font-signature.d.ts
3
+ export declare const COLLECTION_TAG = "ttcf";
4
+ export declare function classifyFont(bytes: Uint8Array, offset?: number): FontFormat | undefined;
5
+ //#endregion
@@ -0,0 +1,13 @@
1
+ //#region src/font-signature.ts
2
+ const COLLECTION_TAG = "ttcf";
3
+ function classifyFont(bytes, offset = 0) {
4
+ if (!Number.isSafeInteger(offset) || offset < 0 || offset > bytes.length - 4) return;
5
+ const tag = String.fromCharCode(bytes[offset] ?? 0, bytes[offset + 1] ?? 0, bytes[offset + 2] ?? 0, bytes[offset + 3] ?? 0);
6
+ if (tag === "wOF2") return "woff2";
7
+ if (tag === "wOFF") return "woff";
8
+ if (tag === "OTTO") return "opentype";
9
+ if (tag === "ttcf") return "collection";
10
+ if (tag === "true" || tag === "\0\0\0") return "truetype";
11
+ }
12
+ //#endregion
13
+ export { COLLECTION_TAG, classifyFont };
package/dist/fonts.d.ts CHANGED
@@ -20,7 +20,7 @@ export declare function localFontReferences(references: readonly FontReference[]
20
20
  local: string;
21
21
  fallback: string;
22
22
  }>;
23
- export declare const FONT_FORMATS: readonly ["woff2", "woff", "truetype", "opentype"];
23
+ export declare const FONT_FORMATS: readonly ["woff2", "woff", "truetype", "opentype", "collection"];
24
24
  export type FontFormat = (typeof FONT_FORMATS)[number];
25
25
  export declare const LocalFaceTransport: z.ZodObject<{
26
26
  family: z.ZodString;
@@ -29,12 +29,14 @@ export declare const LocalFaceTransport: z.ZodObject<{
29
29
  woff: "woff";
30
30
  truetype: "truetype";
31
31
  opentype: "opentype";
32
+ collection: "collection";
32
33
  }>;
33
34
  weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
34
35
  style: z.ZodOptional<z.ZodEnum<{
35
36
  normal: "normal";
36
37
  italic: "italic";
37
38
  }>>;
39
+ postscriptName: z.ZodOptional<z.ZodString>;
38
40
  data: z.ZodString;
39
41
  }, z.core.$strict>;
40
42
  export type LocalFaceTransport = z.infer<typeof LocalFaceTransport>;
@@ -45,12 +47,14 @@ export declare const LocalFacesTransport: z.ZodArray<z.ZodObject<{
45
47
  woff: "woff";
46
48
  truetype: "truetype";
47
49
  opentype: "opentype";
50
+ collection: "collection";
48
51
  }>;
49
52
  weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
50
53
  style: z.ZodOptional<z.ZodEnum<{
51
54
  normal: "normal";
52
55
  italic: "italic";
53
56
  }>>;
57
+ postscriptName: z.ZodOptional<z.ZodString>;
54
58
  data: z.ZodString;
55
59
  }, z.core.$strict>>;
56
60
  export type LocalFacesInput = LocalFaceTransport[];
@@ -63,6 +67,7 @@ export interface FontFace {
63
67
  weight?: number | string;
64
68
  style?: 'normal' | 'italic';
65
69
  unicodeRange?: string;
70
+ postscriptName?: string;
66
71
  }
67
72
  export interface AppFont {
68
73
  family: string;
package/dist/fonts.js CHANGED
@@ -26,13 +26,15 @@ const FONT_FORMATS = [
26
26
  "woff2",
27
27
  "woff",
28
28
  "truetype",
29
- "opentype"
29
+ "opentype",
30
+ "collection"
30
31
  ];
31
32
  const LocalFaceTransportShape = {
32
33
  family: z.string().min(1),
33
34
  format: z.enum(FONT_FORMATS),
34
35
  weight: z.union([z.number(), z.string()]).optional(),
35
36
  style: z.enum(["normal", "italic"]).optional(),
37
+ postscriptName: z.string().min(1).optional(),
36
38
  data: z.string()
37
39
  };
38
40
  const LocalFaceTransport = z.strictObject(LocalFaceTransportShape);
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ //#region src/geometry.d.ts
3
+ export declare const Size: z.ZodObject<{
4
+ width: z.ZodNumber;
5
+ height: z.ZodNumber;
6
+ }, z.core.$strip>;
7
+ export type Size = z.infer<typeof Size>;
8
+ export declare const Box: z.ZodObject<{
9
+ x: z.ZodNumber;
10
+ y: z.ZodNumber;
11
+ width: z.ZodNumber;
12
+ height: z.ZodNumber;
13
+ }, z.core.$strip>;
14
+ export type Box = z.infer<typeof Box>;
15
+ export declare const Point: z.ZodObject<{
16
+ x: z.ZodNumber;
17
+ y: z.ZodNumber;
18
+ }, z.core.$strip>;
19
+ export type Point = z.infer<typeof Point>;
20
+ //#endregion
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ //#region src/geometry.ts
3
+ const Size = z.object({
4
+ width: z.number().int().positive(),
5
+ height: z.number().int().positive()
6
+ });
7
+ const Box = z.object({
8
+ x: z.number(),
9
+ y: z.number(),
10
+ width: z.number(),
11
+ height: z.number()
12
+ });
13
+ const Point = z.object({
14
+ x: z.number(),
15
+ y: z.number()
16
+ });
17
+ //#endregion
18
+ export { Box, Point, Size };
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ //#region src/image-fit.d.ts
3
+ export declare const ImageFit: z.ZodEnum<{
4
+ width: "width";
5
+ contain: "contain";
6
+ cover: "cover";
7
+ focus: "focus";
8
+ }>;
9
+ export type ImageFit = z.infer<typeof ImageFit>;
10
+ //#endregion
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ //#region src/image-fit.ts
3
+ const ImageFit = z.enum([
4
+ "contain",
5
+ "cover",
6
+ "width",
7
+ "focus"
8
+ ]);
9
+ //#endregion
10
+ export { ImageFit };
@@ -1,5 +1,5 @@
1
1
  import { MarkSegment } from "./paper.js";
2
- import { Imposition } from "./index.js";
2
+ import { Imposition } from "./imposition-schema.js";
3
3
  //#region src/imposition-marks.d.ts
4
4
  export declare const MIN_MARK_LENGTH_MM = 2;
5
5
  export type ImpositionMarkEdge = 'top' | 'right' | 'bottom' | 'left';
@@ -0,0 +1,185 @@
1
+ import { z } from "zod";
2
+ //#region src/imposition-schema.d.ts
3
+ export declare const MAX_IMPOSITION_CELLS = 10000;
4
+ export declare const Imposition: z.ZodPipe<z.ZodObject<{
5
+ paper: z.ZodUnion<readonly [z.ZodEnum<{
6
+ letter: "letter";
7
+ legal: "legal";
8
+ tabloid: "tabloid";
9
+ a3: "a3";
10
+ a4: "a4";
11
+ a5: "a5";
12
+ "business-card-us": "business-card-us";
13
+ "business-card-eu": "business-card-eu";
14
+ "business-card-square-us": "business-card-square-us";
15
+ "business-card-slim-us": "business-card-slim-us";
16
+ "postcard-4x6": "postcard-4x6";
17
+ "postcard-5x7": "postcard-5x7";
18
+ "postcard-6x9": "postcard-6x9";
19
+ "postcard-6x11": "postcard-6x11";
20
+ "card-square-4in": "card-square-4in";
21
+ "half-letter": "half-letter";
22
+ a6: "a6";
23
+ dl: "dl";
24
+ "rack-card-4x9": "rack-card-4x9";
25
+ "rack-card-3.5x8.5": "rack-card-3.5x8.5";
26
+ "poster-12x18": "poster-12x18";
27
+ "poster-16x20": "poster-16x20";
28
+ "poster-18x24": "poster-18x24";
29
+ "poster-24x36": "poster-24x36";
30
+ a2: "a2";
31
+ a1: "a1";
32
+ a0: "a0";
33
+ }>, z.ZodObject<{
34
+ width: z.ZodNumber;
35
+ height: z.ZodNumber;
36
+ unit: z.ZodEnum<{
37
+ mm: "mm";
38
+ in: "in";
39
+ pt: "pt";
40
+ }>;
41
+ }, z.core.$strip>]>;
42
+ orientation: z.ZodDefault<z.ZodEnum<{
43
+ portrait: "portrait";
44
+ landscape: "landscape";
45
+ }>>;
46
+ unit: z.ZodDefault<z.ZodEnum<{
47
+ mm: "mm";
48
+ in: "in";
49
+ pt: "pt";
50
+ }>>;
51
+ margin: z.ZodDefault<z.ZodObject<{
52
+ top: z.ZodDefault<z.ZodNumber>;
53
+ right: z.ZodDefault<z.ZodNumber>;
54
+ bottom: z.ZodDefault<z.ZodNumber>;
55
+ left: z.ZodDefault<z.ZodNumber>;
56
+ }, z.core.$strip>>;
57
+ columns: z.ZodOptional<z.ZodNumber>;
58
+ rows: z.ZodOptional<z.ZodNumber>;
59
+ cell: z.ZodObject<{
60
+ width: z.ZodOptional<z.ZodNumber>;
61
+ height: z.ZodNumber;
62
+ }, z.core.$strip>;
63
+ gap: z.ZodDefault<z.ZodObject<{
64
+ column: z.ZodDefault<z.ZodNumber>;
65
+ row: z.ZodDefault<z.ZodNumber>;
66
+ }, z.core.$strip>>;
67
+ bleed: z.ZodDefault<z.ZodNumber>;
68
+ safe: z.ZodDefault<z.ZodNumber>;
69
+ fit: z.ZodDefault<z.ZodEnum<{
70
+ contain: "contain";
71
+ cover: "cover";
72
+ }>>;
73
+ fill: z.ZodDefault<z.ZodEnum<{
74
+ sequence: "sequence";
75
+ repeat: "repeat";
76
+ }>>;
77
+ sides: z.ZodOptional<z.ZodEnum<{
78
+ one: "one";
79
+ two: "two";
80
+ }>>;
81
+ flip: z.ZodDefault<z.ZodEnum<{
82
+ long: "long";
83
+ short: "short";
84
+ }>>;
85
+ skip: z.ZodDefault<z.ZodNumber>;
86
+ dir: z.ZodDefault<z.ZodEnum<{
87
+ ltr: "ltr";
88
+ rtl: "rtl";
89
+ }>>;
90
+ marks: z.ZodDefault<z.ZodBoolean>;
91
+ markColor: z.ZodDefault<z.ZodEnum<{
92
+ black: "black";
93
+ registration: "registration";
94
+ }>>;
95
+ cornerMarks: z.ZodDefault<z.ZodBoolean>;
96
+ fold: z.ZodOptional<z.ZodEnum<{
97
+ custom: "custom";
98
+ letter: "letter";
99
+ half: "half";
100
+ z: "z";
101
+ gate: "gate";
102
+ }>>;
103
+ panels: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
104
+ }, z.core.$strip>, z.ZodTransform<{
105
+ paper: "letter" | "legal" | "tabloid" | "a3" | "a4" | "a5" | "business-card-us" | "business-card-eu" | "business-card-square-us" | "business-card-slim-us" | "postcard-4x6" | "postcard-5x7" | "postcard-6x9" | "postcard-6x11" | "card-square-4in" | "half-letter" | "a6" | "dl" | "rack-card-4x9" | "rack-card-3.5x8.5" | "poster-12x18" | "poster-16x20" | "poster-18x24" | "poster-24x36" | "a2" | "a1" | "a0" | {
106
+ width: number;
107
+ height: number;
108
+ unit: "mm" | "in" | "pt";
109
+ };
110
+ orientation: "portrait" | "landscape";
111
+ unit: "mm" | "in" | "pt";
112
+ margin: {
113
+ top: number;
114
+ right: number;
115
+ bottom: number;
116
+ left: number;
117
+ };
118
+ cell: {
119
+ height: number;
120
+ width?: number | undefined;
121
+ };
122
+ gap: {
123
+ column: number;
124
+ row: number;
125
+ };
126
+ bleed: number;
127
+ safe: number;
128
+ fit: "contain" | "cover";
129
+ fill: "sequence" | "repeat";
130
+ flip: "long" | "short";
131
+ skip: number;
132
+ dir: "ltr" | "rtl";
133
+ marks: boolean;
134
+ markColor: "black" | "registration";
135
+ cornerMarks: boolean;
136
+ columns?: number | undefined;
137
+ rows?: number | undefined;
138
+ sides?: "one" | "two" | undefined;
139
+ fold?: "custom" | "letter" | "half" | "z" | "gate" | undefined;
140
+ panels?: number[] | undefined;
141
+ } & {
142
+ columns: number;
143
+ rows: number;
144
+ sides: "one" | "two";
145
+ }, {
146
+ paper: "letter" | "legal" | "tabloid" | "a3" | "a4" | "a5" | "business-card-us" | "business-card-eu" | "business-card-square-us" | "business-card-slim-us" | "postcard-4x6" | "postcard-5x7" | "postcard-6x9" | "postcard-6x11" | "card-square-4in" | "half-letter" | "a6" | "dl" | "rack-card-4x9" | "rack-card-3.5x8.5" | "poster-12x18" | "poster-16x20" | "poster-18x24" | "poster-24x36" | "a2" | "a1" | "a0" | {
147
+ width: number;
148
+ height: number;
149
+ unit: "mm" | "in" | "pt";
150
+ };
151
+ orientation: "portrait" | "landscape";
152
+ unit: "mm" | "in" | "pt";
153
+ margin: {
154
+ top: number;
155
+ right: number;
156
+ bottom: number;
157
+ left: number;
158
+ };
159
+ cell: {
160
+ height: number;
161
+ width?: number | undefined;
162
+ };
163
+ gap: {
164
+ column: number;
165
+ row: number;
166
+ };
167
+ bleed: number;
168
+ safe: number;
169
+ fit: "contain" | "cover";
170
+ fill: "sequence" | "repeat";
171
+ flip: "long" | "short";
172
+ skip: number;
173
+ dir: "ltr" | "rtl";
174
+ marks: boolean;
175
+ markColor: "black" | "registration";
176
+ cornerMarks: boolean;
177
+ columns?: number | undefined;
178
+ rows?: number | undefined;
179
+ sides?: "one" | "two" | undefined;
180
+ fold?: "custom" | "letter" | "half" | "z" | "gate" | undefined;
181
+ panels?: number[] | undefined;
182
+ }>>;
183
+ export type Imposition = z.infer<typeof Imposition>;
184
+ export type ImpositionInput = z.input<typeof Imposition>;
185
+ //#endregion