@segnavia/format 0.39.0 → 0.40.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.
@@ -165,9 +165,9 @@ export declare const PlacedSection: z.ZodObject<{
165
165
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
166
166
  box: z.ZodOptional<z.ZodEnum<{
167
167
  media: "media";
168
- bleed: "bleed";
169
168
  crop: "crop";
170
169
  trim: "trim";
170
+ bleed: "bleed";
171
171
  art: "art";
172
172
  }>>;
173
173
  crop: z.ZodOptional<z.ZodObject<{
@@ -278,9 +278,9 @@ export declare const BookFrontMatterEntry: z.ZodDiscriminatedUnion<[z.ZodObject<
278
278
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
279
279
  box: z.ZodOptional<z.ZodEnum<{
280
280
  media: "media";
281
- bleed: "bleed";
282
281
  crop: "crop";
283
282
  trim: "trim";
283
+ bleed: "bleed";
284
284
  art: "art";
285
285
  }>>;
286
286
  crop: z.ZodOptional<z.ZodObject<{
@@ -411,9 +411,9 @@ export declare const BookChapterEntry: z.ZodDiscriminatedUnion<[z.ZodObject<{
411
411
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
412
412
  box: z.ZodOptional<z.ZodEnum<{
413
413
  media: "media";
414
- bleed: "bleed";
415
414
  crop: "crop";
416
415
  trim: "trim";
416
+ bleed: "bleed";
417
417
  art: "art";
418
418
  }>>;
419
419
  crop: z.ZodOptional<z.ZodObject<{
package/dist/book.d.ts CHANGED
@@ -40,8 +40,8 @@ export declare const BookPage: z.ZodObject<{
40
40
  width: z.ZodNumber;
41
41
  height: z.ZodNumber;
42
42
  unit: z.ZodEnum<{
43
- mm: "mm";
44
43
  in: "in";
44
+ mm: "mm";
45
45
  pt: "pt";
46
46
  }>;
47
47
  }, z.core.$strip>]>;
@@ -130,8 +130,8 @@ export declare const BookShape: z.ZodObject<{
130
130
  width: z.ZodNumber;
131
131
  height: z.ZodNumber;
132
132
  unit: z.ZodEnum<{
133
- mm: "mm";
134
133
  in: "in";
134
+ mm: "mm";
135
135
  pt: "pt";
136
136
  }>;
137
137
  }, z.core.$strip>]>;
@@ -229,9 +229,9 @@ export declare const BookShape: z.ZodObject<{
229
229
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
230
230
  box: z.ZodOptional<z.ZodEnum<{
231
231
  media: "media";
232
- bleed: "bleed";
233
232
  crop: "crop";
234
233
  trim: "trim";
234
+ bleed: "bleed";
235
235
  art: "art";
236
236
  }>>;
237
237
  crop: z.ZodOptional<z.ZodObject<{
@@ -505,16 +505,16 @@ export declare const BookViewPagination: z.ZodObject<{
505
505
  }, z.core.$strip>;
506
506
  export type BookViewPagination = z.infer<typeof BookViewPagination>;
507
507
  export declare const BookView: z.ZodObject<{
508
- scripts: z.ZodDefault<z.ZodEnum<{
509
- refuse: "refuse";
510
- sandboxed: "sandboxed";
511
- }>>;
512
508
  dir: z.ZodOptional<z.ZodEnum<{
513
509
  auto: "auto";
514
510
  ltr: "ltr";
515
511
  rtl: "rtl";
516
512
  }>>;
517
513
  lang: z.ZodOptional<z.ZodString>;
514
+ scripts: z.ZodDefault<z.ZodEnum<{
515
+ refuse: "refuse";
516
+ sandboxed: "sandboxed";
517
+ }>>;
518
518
  fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
519
519
  app: z.ZodString;
520
520
  }, z.core.$strip>, z.ZodObject<{
@@ -643,8 +643,8 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
643
643
  width: z.ZodNumber;
644
644
  height: z.ZodNumber;
645
645
  unit: z.ZodEnum<{
646
- mm: "mm";
647
646
  in: "in";
647
+ mm: "mm";
648
648
  pt: "pt";
649
649
  }>;
650
650
  }, z.core.$strip>]>;
@@ -742,9 +742,9 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
742
742
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
743
743
  box: z.ZodOptional<z.ZodEnum<{
744
744
  media: "media";
745
- bleed: "bleed";
746
745
  crop: "crop";
747
746
  trim: "trim";
747
+ bleed: "bleed";
748
748
  art: "art";
749
749
  }>>;
750
750
  crop: z.ZodOptional<z.ZodObject<{
@@ -1013,7 +1013,7 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
1013
1013
  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" | {
1014
1014
  width: number;
1015
1015
  height: number;
1016
- unit: "mm" | "in" | "pt";
1016
+ unit: "in" | "mm" | "pt";
1017
1017
  };
1018
1018
  orientation: "portrait" | "landscape";
1019
1019
  margin: {
@@ -1118,7 +1118,7 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
1118
1118
  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" | {
1119
1119
  width: number;
1120
1120
  height: number;
1121
- unit: "mm" | "in" | "pt";
1121
+ unit: "in" | "mm" | "pt";
1122
1122
  };
1123
1123
  orientation: "portrait" | "landscape";
1124
1124
  margin: {
@@ -1171,7 +1171,7 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
1171
1171
  kind: "deck" | "page" | "paper" | "book" | "media" | "shot";
1172
1172
  address: string;
1173
1173
  page?: string | number | undefined;
1174
- box?: "media" | "bleed" | "crop" | "trim" | "art" | undefined;
1174
+ box?: "media" | "crop" | "trim" | "bleed" | "art" | undefined;
1175
1175
  crop?: {
1176
1176
  top?: string | undefined;
1177
1177
  right?: string | undefined;
@@ -1295,7 +1295,7 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
1295
1295
  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" | {
1296
1296
  width: number;
1297
1297
  height: number;
1298
- unit: "mm" | "in" | "pt";
1298
+ unit: "in" | "mm" | "pt";
1299
1299
  };
1300
1300
  orientation: "portrait" | "landscape";
1301
1301
  margin: {
@@ -1396,7 +1396,7 @@ export declare const Book: z.ZodPipe<z.ZodPreprocess<z.ZodPipe<z.ZodObject<{
1396
1396
  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" | {
1397
1397
  width: number;
1398
1398
  height: number;
1399
- unit: "mm" | "in" | "pt";
1399
+ unit: "in" | "mm" | "pt";
1400
1400
  };
1401
1401
  orientation: "portrait" | "landscape";
1402
1402
  margin: {
package/dist/cover.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Page, PageBody } from "./page.js";
1
2
  import { Motif } from "./motif.js";
2
- import { Page } from "./page.js";
3
3
  import { z } from "zod";
4
4
  //#region src/cover.d.ts
5
5
  export declare const COVER_SHEET: {
@@ -8,14 +8,23 @@ export declare const COVER_SHEET: {
8
8
  };
9
9
  export declare const COVER_DRAWING_VERSION = 1;
10
10
  export declare const Cover: z.ZodPipe<z.ZodObject<{
11
- page: z.ZodObject<{
11
+ page: z.ZodPipe<z.ZodObject<{
12
12
  id: z.ZodOptional<z.ZodString>;
13
- html: z.ZodString;
14
- size: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"fluid">, z.ZodObject<{
13
+ body: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
14
+ html: z.ZodString;
15
+ }, z.core.$strict>, z.ZodObject<{
16
+ markdown: z.ZodString;
17
+ }, z.core.$strict>]>>;
18
+ html: z.ZodOptional<z.ZodString>;
19
+ markdown: z.ZodOptional<z.ZodString>;
20
+ size: z.ZodDefault<z.ZodUnion<readonly [z.ZodPipe<z.ZodLiteral<"fluid">, z.ZodTransform<{
21
+ readonly width: "full";
22
+ readonly height: "auto";
23
+ }, "fluid">>, z.ZodObject<{
15
24
  width: z.ZodNumber;
16
25
  height: z.ZodNumber;
17
26
  }, z.core.$strip>, z.ZodObject<{
18
- width: z.ZodNumber;
27
+ width: z.ZodUnion<readonly [z.ZodLiteral<"full">, z.ZodLiteral<"standard">, z.ZodLiteral<"wide">, z.ZodNumber]>;
19
28
  height: z.ZodLiteral<"auto">;
20
29
  }, z.core.$strip>]>>;
21
30
  scripts: z.ZodDefault<z.ZodEnum<{
@@ -61,8 +70,8 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
61
70
  width: z.ZodNumber;
62
71
  height: z.ZodNumber;
63
72
  unit: z.ZodEnum<{
64
- mm: "mm";
65
73
  in: "in";
74
+ mm: "mm";
66
75
  pt: "pt";
67
76
  }>;
68
77
  }, z.core.$strip>]>;
@@ -167,7 +176,155 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
167
176
  local: z.ZodString;
168
177
  fallback: z.ZodString;
169
178
  }, z.core.$strip>]>>>;
170
- }, z.core.$strip>;
179
+ }, z.core.$strip>, z.ZodTransform<{
180
+ body: PageBody;
181
+ size: {
182
+ width: number;
183
+ height: number;
184
+ } | {
185
+ readonly width: "full";
186
+ readonly height: "auto";
187
+ } | {
188
+ width: number | "full" | "standard" | "wide";
189
+ height: "auto";
190
+ };
191
+ scripts: "refuse" | "sandboxed";
192
+ id?: string | undefined;
193
+ dir?: "auto" | "ltr" | "rtl" | undefined;
194
+ lang?: string | undefined;
195
+ print?: {
196
+ 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" | {
197
+ width: number;
198
+ height: number;
199
+ unit: "in" | "mm" | "pt";
200
+ };
201
+ orientation: "portrait" | "landscape";
202
+ bleed: number;
203
+ safe: number;
204
+ marks: boolean;
205
+ markColor: "black" | "registration";
206
+ margin?: {
207
+ top: number;
208
+ right: number;
209
+ bottom: number;
210
+ left: number;
211
+ } | undefined;
212
+ } | undefined;
213
+ printedPages?: {
214
+ parents: {
215
+ name: string;
216
+ basedOn?: string | undefined;
217
+ margin?: {
218
+ top: number;
219
+ bottom: number;
220
+ inner: number;
221
+ outer: number;
222
+ } | undefined;
223
+ head?: string | undefined;
224
+ foot?: string | undefined;
225
+ }[];
226
+ rules: {
227
+ last?: string | undefined;
228
+ verso?: string | undefined;
229
+ recto?: string | undefined;
230
+ first?: string | undefined;
231
+ every: string;
232
+ };
233
+ numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
234
+ } | undefined;
235
+ slots?: {
236
+ key: string;
237
+ label: string;
238
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
239
+ required: boolean;
240
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
241
+ placeholder?: string | undefined;
242
+ minSize?: number | undefined;
243
+ }[] | undefined;
244
+ fonts?: ({
245
+ app: string;
246
+ } | {
247
+ local: string;
248
+ fallback: string;
249
+ })[] | undefined;
250
+ }, {
251
+ size: {
252
+ width: number;
253
+ height: number;
254
+ } | {
255
+ readonly width: "full";
256
+ readonly height: "auto";
257
+ } | {
258
+ width: number | "full" | "standard" | "wide";
259
+ height: "auto";
260
+ };
261
+ scripts: "refuse" | "sandboxed";
262
+ id?: string | undefined;
263
+ body?: {
264
+ html: string;
265
+ } | {
266
+ markdown: string;
267
+ } | undefined;
268
+ html?: string | undefined;
269
+ markdown?: string | undefined;
270
+ dir?: "auto" | "ltr" | "rtl" | undefined;
271
+ lang?: string | undefined;
272
+ print?: {
273
+ 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" | {
274
+ width: number;
275
+ height: number;
276
+ unit: "in" | "mm" | "pt";
277
+ };
278
+ orientation: "portrait" | "landscape";
279
+ bleed: number;
280
+ safe: number;
281
+ marks: boolean;
282
+ markColor: "black" | "registration";
283
+ margin?: {
284
+ top: number;
285
+ right: number;
286
+ bottom: number;
287
+ left: number;
288
+ } | undefined;
289
+ } | undefined;
290
+ printedPages?: {
291
+ parents: {
292
+ name: string;
293
+ basedOn?: string | undefined;
294
+ margin?: {
295
+ top: number;
296
+ bottom: number;
297
+ inner: number;
298
+ outer: number;
299
+ } | undefined;
300
+ head?: string | undefined;
301
+ foot?: string | undefined;
302
+ }[];
303
+ rules: {
304
+ last?: string | undefined;
305
+ verso?: string | undefined;
306
+ recto?: string | undefined;
307
+ first?: string | undefined;
308
+ every: string;
309
+ };
310
+ numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
311
+ } | undefined;
312
+ slots?: {
313
+ key: string;
314
+ label: string;
315
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
316
+ required: boolean;
317
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
318
+ placeholder?: string | undefined;
319
+ minSize?: number | undefined;
320
+ }[] | undefined;
321
+ fonts?: ({
322
+ app: string;
323
+ } | {
324
+ local: string;
325
+ fallback: string;
326
+ })[] | undefined;
327
+ }>>;
171
328
  id: z.ZodOptional<z.ZodString>;
172
329
  name: z.ZodOptional<z.ZodString>;
173
330
  }, z.core.$strip>, z.ZodTransform<{
@@ -176,7 +333,7 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
176
333
  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" | {
177
334
  width: number;
178
335
  height: number;
179
- unit: "mm" | "in" | "pt";
336
+ unit: "in" | "mm" | "pt";
180
337
  };
181
338
  orientation: "portrait" | "landscape";
182
339
  bleed: number;
@@ -190,12 +347,15 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
190
347
  left: number;
191
348
  } | undefined;
192
349
  };
193
- html: string;
194
- size: "fluid" | {
350
+ body: PageBody;
351
+ size: {
195
352
  width: number;
196
353
  height: number;
197
354
  } | {
198
- width: number;
355
+ readonly width: "full";
356
+ readonly height: "auto";
357
+ } | {
358
+ width: number | "full" | "standard" | "wide";
199
359
  height: "auto";
200
360
  };
201
361
  scripts: "refuse" | "sandboxed";
@@ -244,12 +404,15 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
244
404
  name?: string | undefined;
245
405
  }, {
246
406
  page: {
247
- html: string;
248
- size: "fluid" | {
407
+ body: PageBody;
408
+ size: {
249
409
  width: number;
250
410
  height: number;
251
411
  } | {
252
- width: number;
412
+ readonly width: "full";
413
+ readonly height: "auto";
414
+ } | {
415
+ width: number | "full" | "standard" | "wide";
253
416
  height: "auto";
254
417
  };
255
418
  scripts: "refuse" | "sandboxed";
@@ -260,7 +423,7 @@ export declare const Cover: z.ZodPipe<z.ZodObject<{
260
423
  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" | {
261
424
  width: number;
262
425
  height: number;
263
- unit: "mm" | "in" | "pt";
426
+ unit: "in" | "mm" | "pt";
264
427
  };
265
428
  orientation: "portrait" | "landscape";
266
429
  bleed: number;
@@ -93,7 +93,7 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
93
93
  kind: "deck" | "page" | "paper" | "book" | "media" | "shot";
94
94
  address: string;
95
95
  page?: string | number | undefined;
96
- box?: "media" | "bleed" | "crop" | "trim" | "art" | undefined;
96
+ box?: "media" | "crop" | "trim" | "bleed" | "art" | undefined;
97
97
  crop?: {
98
98
  top?: string | undefined;
99
99
  right?: string | undefined;
package/dist/deck.d.ts CHANGED
@@ -257,9 +257,9 @@ export declare const SlideContent: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
257
257
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
258
258
  box: z.ZodOptional<z.ZodEnum<{
259
259
  media: "media";
260
- bleed: "bleed";
261
260
  crop: "crop";
262
261
  trim: "trim";
262
+ bleed: "bleed";
263
263
  art: "art";
264
264
  }>>;
265
265
  crop: z.ZodOptional<z.ZodObject<{
@@ -384,9 +384,9 @@ export declare const Slide: z.ZodObject<{
384
384
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
385
385
  box: z.ZodOptional<z.ZodEnum<{
386
386
  media: "media";
387
- bleed: "bleed";
388
387
  crop: "crop";
389
388
  trim: "trim";
389
+ bleed: "bleed";
390
390
  art: "art";
391
391
  }>>;
392
392
  crop: z.ZodOptional<z.ZodObject<{
@@ -633,9 +633,9 @@ export declare const Deck: z.ZodObject<{
633
633
  page: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
634
634
  box: z.ZodOptional<z.ZodEnum<{
635
635
  media: "media";
636
- bleed: "bleed";
637
636
  crop: "crop";
638
637
  trim: "trim";
638
+ bleed: "bleed";
639
639
  art: "art";
640
640
  }>>;
641
641
  crop: z.ZodOptional<z.ZodObject<{
@@ -34,8 +34,8 @@ export declare const Imposition: z.ZodPipe<z.ZodObject<{
34
34
  width: z.ZodNumber;
35
35
  height: z.ZodNumber;
36
36
  unit: z.ZodEnum<{
37
- mm: "mm";
38
37
  in: "in";
38
+ mm: "mm";
39
39
  pt: "pt";
40
40
  }>;
41
41
  }, z.core.$strip>]>;
@@ -44,8 +44,8 @@ export declare const Imposition: z.ZodPipe<z.ZodObject<{
44
44
  landscape: "landscape";
45
45
  }>>;
46
46
  unit: z.ZodDefault<z.ZodEnum<{
47
- mm: "mm";
48
47
  in: "in";
48
+ mm: "mm";
49
49
  pt: "pt";
50
50
  }>>;
51
51
  margin: z.ZodDefault<z.ZodObject<{
@@ -105,10 +105,10 @@ export declare const Imposition: z.ZodPipe<z.ZodObject<{
105
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
106
  width: number;
107
107
  height: number;
108
- unit: "mm" | "in" | "pt";
108
+ unit: "in" | "mm" | "pt";
109
109
  };
110
110
  orientation: "portrait" | "landscape";
111
- unit: "mm" | "in" | "pt";
111
+ unit: "in" | "mm" | "pt";
112
112
  margin: {
113
113
  top: number;
114
114
  right: number;
@@ -146,10 +146,10 @@ export declare const Imposition: z.ZodPipe<z.ZodObject<{
146
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
147
  width: number;
148
148
  height: number;
149
- unit: "mm" | "in" | "pt";
149
+ unit: "in" | "mm" | "pt";
150
150
  };
151
151
  orientation: "portrait" | "landscape";
152
- unit: "mm" | "in" | "pt";
152
+ unit: "in" | "mm" | "pt";
153
153
  margin: {
154
154
  top: number;
155
155
  right: number;
@@ -1,4 +1,4 @@
1
- import { Page } from "./page.js";
1
+ import { Page, PageWidths } from "./page.js";
2
2
  import { Print } from "./print.js";
3
3
  import { PaperBox } from "./paper.js";
4
4
  import { Imposition } from "./imposition-schema.js";
@@ -59,6 +59,6 @@ export declare function impose(imposition: Imposition, pageCount: number): Impos
59
59
  export declare function fitPage(page: {
60
60
  size: Page['size'];
61
61
  print?: Print;
62
- }, placement: ImpositionPlacement, fit: 'contain' | 'cover'): PageFit;
62
+ }, placement: ImpositionPlacement, fit: 'contain' | 'cover', pageWidths?: PageWidths): PageFit;
63
63
  export declare function pagePlacementLayout(size: Page['size'], placement: ImpositionPlacement, fit: PageFit): PagePlacementLayout;
64
64
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { PX_PER_MM, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
2
+ import { resolvePageWidth } from "./page.js";
2
3
  import { foldCellPages, foldPageCountMessage } from "./fold.js";
3
4
  //#region src/imposition.ts
4
5
  const zeroCrop = () => ({
@@ -225,46 +226,56 @@ function trimDiffers(page, placement) {
225
226
  const trim = sheetMm(page.print);
226
227
  return Math.abs(trim.width - placement.trim.width) > .01 || Math.abs(trim.height - placement.trim.height) > .01;
227
228
  }
228
- function fitPage(page, placement, fit) {
229
+ function fitPage(page, placement, fit, pageWidths) {
229
230
  const differs = trimDiffers(page, placement);
230
- if (page.size === "fluid") return {
231
- flow: true,
232
- width: placement.bleedBox.width * PX_PER_MM,
233
- height: null,
234
- scale: 1,
235
- x: placement.bleedBox.x,
236
- y: placement.bleedBox.y,
237
- bands: {
238
- inline: 0,
239
- block: 0
240
- },
241
- crop: zeroCrop(),
242
- differs
243
- };
244
- if (page.size.height === "auto") return {
245
- flow: true,
246
- width: page.size.width,
247
- height: null,
248
- scale: placement.trim.width * PX_PER_MM / page.size.width,
249
- x: placement.trim.x,
250
- y: placement.trim.y,
251
- bands: {
252
- inline: 0,
253
- block: 0
254
- },
255
- crop: zeroCrop(),
256
- differs
257
- };
231
+ const size = page.size;
232
+ if (size.height === "auto") {
233
+ const resolved = resolvePageWidth(size, pageWidths);
234
+ if (size.width !== "full") {
235
+ const named = typeof size.width === "string";
236
+ const width = named ? Math.min(resolved.viewportWidth, placement.trim.width * PX_PER_MM) : resolved.viewportWidth;
237
+ const scale = named ? 1 : placement.trim.width * PX_PER_MM / width;
238
+ const inline = named ? (placement.trim.width - width / PX_PER_MM) / 2 : 0;
239
+ return {
240
+ flow: true,
241
+ width,
242
+ height: null,
243
+ scale,
244
+ x: roundMillimeters(placement.trim.x + inline),
245
+ y: placement.trim.y,
246
+ bands: {
247
+ inline: 0,
248
+ block: 0
249
+ },
250
+ crop: zeroCrop(),
251
+ differs
252
+ };
253
+ }
254
+ return {
255
+ flow: true,
256
+ width: placement.bleedBox.width * PX_PER_MM,
257
+ height: null,
258
+ scale: 1,
259
+ x: placement.bleedBox.x,
260
+ y: placement.bleedBox.y,
261
+ bands: {
262
+ inline: 0,
263
+ block: 0
264
+ },
265
+ crop: zeroCrop(),
266
+ differs
267
+ };
268
+ }
258
269
  if (fit === "contain") {
259
- const scale = Math.min(placement.trim.width * PX_PER_MM / page.size.width, placement.trim.height * PX_PER_MM / page.size.height);
260
- const width = page.size.width * scale / PX_PER_MM;
261
- const height = page.size.height * scale / PX_PER_MM;
270
+ const scale = Math.min(placement.trim.width * PX_PER_MM / size.width, placement.trim.height * PX_PER_MM / size.height);
271
+ const width = size.width * scale / PX_PER_MM;
272
+ const height = size.height * scale / PX_PER_MM;
262
273
  const inline = (placement.trim.width - width) / 2;
263
274
  const block = (placement.trim.height - height) / 2;
264
275
  return {
265
276
  flow: false,
266
- width: page.size.width,
267
- height: page.size.height,
277
+ width: size.width,
278
+ height: size.height,
268
279
  scale,
269
280
  x: roundMillimeters(placement.trim.x + inline),
270
281
  y: roundMillimeters(placement.trim.y + block),
@@ -278,15 +289,15 @@ function fitPage(page, placement, fit) {
278
289
  }
279
290
  const horizontalBleed = Math.max(placement.bleed.left, placement.bleed.right);
280
291
  const verticalBleed = Math.max(placement.bleed.top, placement.bleed.bottom);
281
- const scale = Math.max((placement.trim.width + horizontalBleed * 2) * PX_PER_MM / page.size.width, (placement.trim.height + verticalBleed * 2) * PX_PER_MM / page.size.height);
282
- const width = page.size.width * scale / PX_PER_MM;
283
- const height = page.size.height * scale / PX_PER_MM;
292
+ const scale = Math.max((placement.trim.width + horizontalBleed * 2) * PX_PER_MM / size.width, (placement.trim.height + verticalBleed * 2) * PX_PER_MM / size.height);
293
+ const width = size.width * scale / PX_PER_MM;
294
+ const height = size.height * scale / PX_PER_MM;
284
295
  const x = placement.trim.x + (placement.trim.width - width) / 2;
285
296
  const y = placement.trim.y + (placement.trim.height - height) / 2;
286
297
  return {
287
298
  flow: false,
288
- width: page.size.width,
289
- height: page.size.height,
299
+ width: size.width,
300
+ height: size.height,
290
301
  scale,
291
302
  x: roundMillimeters(x),
292
303
  y: roundMillimeters(y),
@@ -304,7 +315,7 @@ function fitPage(page, placement, fit) {
304
315
  };
305
316
  }
306
317
  function pagePlacementLayout(size, placement, fit) {
307
- if (size === "fluid") return {
318
+ if (size.width === "full") return {
308
319
  kind: "fluid",
309
320
  piece: {
310
321
  width: placement.bleedBox.width * PX_PER_MM,
@@ -316,14 +327,14 @@ function pagePlacementLayout(size, placement, fit) {
316
327
  if (size.height === "auto") return {
317
328
  kind: "growing",
318
329
  piece: {
319
- width: size.width,
330
+ width: fit.width,
320
331
  height: placement.trim.height * PX_PER_MM / fit.scale
321
332
  },
322
333
  inset: false,
323
334
  paper: {
324
335
  x: fit.x,
325
336
  y: fit.y,
326
- width: placement.trim.width,
337
+ width: fit.width * fit.scale / PX_PER_MM,
327
338
  height: placement.trim.height
328
339
  }
329
340
  };