@segnavia/format 0.38.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.
Files changed (60) 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 +2 -2
  8. package/dist/book-section.d.ts +171 -0
  9. package/dist/book-section.js +13 -2
  10. package/dist/book.d.ts +189 -47
  11. package/dist/book.js +18 -2
  12. package/dist/cover.d.ts +500 -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/direction.d.ts +1 -1
  18. package/dist/font-collection.d.ts +8 -0
  19. package/dist/font-collection.js +191 -0
  20. package/dist/font-face.d.ts +8 -0
  21. package/dist/font-face.js +24 -0
  22. package/dist/font-refusal.d.ts +5 -0
  23. package/dist/font-refusal.js +9 -0
  24. package/dist/font-signature.d.ts +5 -0
  25. package/dist/font-signature.js +13 -0
  26. package/dist/fonts.d.ts +6 -1
  27. package/dist/fonts.js +3 -1
  28. package/dist/geometry.d.ts +20 -0
  29. package/dist/geometry.js +18 -0
  30. package/dist/image-fit.d.ts +10 -0
  31. package/dist/image-fit.js +10 -0
  32. package/dist/imposition-marks.d.ts +1 -1
  33. package/dist/imposition-schema.d.ts +185 -0
  34. package/dist/imposition-schema.js +122 -0
  35. package/dist/imposition.d.ts +8 -6
  36. package/dist/imposition.js +53 -42
  37. package/dist/index.d.ts +23 -1756
  38. package/dist/index.js +29 -212
  39. package/dist/json-schemas.d.ts +2181 -0
  40. package/dist/json-schemas.js +43 -0
  41. package/dist/media.d.ts +152 -0
  42. package/dist/media.js +119 -0
  43. package/dist/note-series.d.ts +4 -4
  44. package/dist/note-series.js +0 -5
  45. package/dist/page.d.ts +359 -0
  46. package/dist/page.js +110 -0
  47. package/dist/paper.d.ts +5 -5
  48. package/dist/placement-cycle.d.ts +5 -0
  49. package/dist/placement-cycle.js +30 -0
  50. package/dist/placement-refusal.d.ts +5 -0
  51. package/dist/placement-refusal.js +6 -0
  52. package/dist/placement.d.ts +76 -0
  53. package/dist/placement.js +100 -0
  54. package/dist/print.d.ts +72 -0
  55. package/dist/print.js +38 -0
  56. package/dist/printed-page-imposition.d.ts +2 -1
  57. package/dist/shots-used.d.ts +0 -1
  58. package/dist/shots-used.js +2 -2
  59. package/dist/slots.d.ts +13 -13
  60. package/package.json +1 -1
@@ -0,0 +1,500 @@
1
+ import { Page, PageBody } from "./page.js";
2
+ import { Motif } from "./motif.js";
3
+ import { z } from "zod";
4
+ //#region src/cover.d.ts
5
+ export declare const COVER_SHEET: {
6
+ readonly width: 160;
7
+ readonly height: 100;
8
+ };
9
+ export declare const COVER_DRAWING_VERSION = 1;
10
+ export declare const Cover: z.ZodPipe<z.ZodObject<{
11
+ page: z.ZodPipe<z.ZodObject<{
12
+ id: z.ZodOptional<z.ZodString>;
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<{
24
+ width: z.ZodNumber;
25
+ height: z.ZodNumber;
26
+ }, z.core.$strip>, z.ZodObject<{
27
+ width: z.ZodUnion<readonly [z.ZodLiteral<"full">, z.ZodLiteral<"standard">, z.ZodLiteral<"wide">, z.ZodNumber]>;
28
+ height: z.ZodLiteral<"auto">;
29
+ }, z.core.$strip>]>>;
30
+ scripts: z.ZodDefault<z.ZodEnum<{
31
+ refuse: "refuse";
32
+ sandboxed: "sandboxed";
33
+ }>>;
34
+ dir: z.ZodOptional<z.ZodEnum<{
35
+ auto: "auto";
36
+ ltr: "ltr";
37
+ rtl: "rtl";
38
+ }>>;
39
+ lang: z.ZodOptional<z.ZodString>;
40
+ print: z.ZodOptional<z.ZodObject<{
41
+ paper: z.ZodUnion<readonly [z.ZodEnum<{
42
+ letter: "letter";
43
+ legal: "legal";
44
+ tabloid: "tabloid";
45
+ a3: "a3";
46
+ a4: "a4";
47
+ a5: "a5";
48
+ "business-card-us": "business-card-us";
49
+ "business-card-eu": "business-card-eu";
50
+ "business-card-square-us": "business-card-square-us";
51
+ "business-card-slim-us": "business-card-slim-us";
52
+ "postcard-4x6": "postcard-4x6";
53
+ "postcard-5x7": "postcard-5x7";
54
+ "postcard-6x9": "postcard-6x9";
55
+ "postcard-6x11": "postcard-6x11";
56
+ "card-square-4in": "card-square-4in";
57
+ "half-letter": "half-letter";
58
+ a6: "a6";
59
+ dl: "dl";
60
+ "rack-card-4x9": "rack-card-4x9";
61
+ "rack-card-3.5x8.5": "rack-card-3.5x8.5";
62
+ "poster-12x18": "poster-12x18";
63
+ "poster-16x20": "poster-16x20";
64
+ "poster-18x24": "poster-18x24";
65
+ "poster-24x36": "poster-24x36";
66
+ a2: "a2";
67
+ a1: "a1";
68
+ a0: "a0";
69
+ }>, z.ZodObject<{
70
+ width: z.ZodNumber;
71
+ height: z.ZodNumber;
72
+ unit: z.ZodEnum<{
73
+ in: "in";
74
+ mm: "mm";
75
+ pt: "pt";
76
+ }>;
77
+ }, z.core.$strip>]>;
78
+ orientation: z.ZodDefault<z.ZodEnum<{
79
+ portrait: "portrait";
80
+ landscape: "landscape";
81
+ }>>;
82
+ margin: z.ZodOptional<z.ZodObject<{
83
+ top: z.ZodDefault<z.ZodNumber>;
84
+ right: z.ZodDefault<z.ZodNumber>;
85
+ bottom: z.ZodDefault<z.ZodNumber>;
86
+ left: z.ZodDefault<z.ZodNumber>;
87
+ }, z.core.$strip>>;
88
+ bleed: z.ZodDefault<z.ZodNumber>;
89
+ safe: z.ZodDefault<z.ZodNumber>;
90
+ marks: z.ZodDefault<z.ZodBoolean>;
91
+ markColor: z.ZodDefault<z.ZodEnum<{
92
+ black: "black";
93
+ registration: "registration";
94
+ }>>;
95
+ }, z.core.$strip>>;
96
+ printedPages: z.ZodOptional<z.ZodObject<{
97
+ parents: z.ZodArray<z.ZodObject<{
98
+ name: z.ZodString;
99
+ basedOn: z.ZodOptional<z.ZodString>;
100
+ margin: z.ZodOptional<z.ZodObject<{
101
+ top: z.ZodNumber;
102
+ bottom: z.ZodNumber;
103
+ inner: z.ZodNumber;
104
+ outer: z.ZodNumber;
105
+ }, z.core.$strip>>;
106
+ head: z.ZodOptional<z.ZodString>;
107
+ foot: z.ZodOptional<z.ZodString>;
108
+ }, z.core.$strip>>;
109
+ rules: z.ZodPipe<z.ZodObject<{
110
+ every: z.ZodString;
111
+ first: z.ZodOptional<z.ZodString>;
112
+ recto: z.ZodOptional<z.ZodString>;
113
+ verso: z.ZodOptional<z.ZodString>;
114
+ last: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$loose>, z.ZodTransform<{
116
+ last?: string | undefined;
117
+ verso?: string | undefined;
118
+ recto?: string | undefined;
119
+ first?: string | undefined;
120
+ every: string;
121
+ }, {
122
+ [x: string]: unknown;
123
+ every: string;
124
+ first?: string | undefined;
125
+ recto?: string | undefined;
126
+ verso?: string | undefined;
127
+ last?: string | undefined;
128
+ }>>;
129
+ numbering: z.ZodOptional<z.ZodEnum<{
130
+ arabic: "arabic";
131
+ "roman-lower": "roman-lower";
132
+ "roman-upper": "roman-upper";
133
+ hebrew: "hebrew";
134
+ }>>;
135
+ }, z.core.$strip>>;
136
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
137
+ key: z.ZodString;
138
+ label: z.ZodString;
139
+ type: z.ZodEnum<{
140
+ text: "text";
141
+ image: "image";
142
+ phone: "phone";
143
+ email: "email";
144
+ link: "link";
145
+ qr: "qr";
146
+ }>;
147
+ required: z.ZodDefault<z.ZodBoolean>;
148
+ placeholder: z.ZodOptional<z.ZodString>;
149
+ overflow: z.ZodDefault<z.ZodEnum<{
150
+ refuse: "refuse";
151
+ shrink: "shrink";
152
+ truncate: "truncate";
153
+ wrap: "wrap";
154
+ }>>;
155
+ minSize: z.ZodOptional<z.ZodNumber>;
156
+ }, z.core.$strip>, z.ZodTransform<{
157
+ key: string;
158
+ label: string;
159
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
160
+ required: boolean;
161
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
162
+ placeholder?: string | undefined;
163
+ minSize?: number | undefined;
164
+ }, {
165
+ key: string;
166
+ label: string;
167
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
168
+ required: boolean;
169
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
170
+ placeholder?: string | undefined;
171
+ minSize?: number | undefined;
172
+ }>>>>;
173
+ fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
174
+ app: z.ZodString;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ local: z.ZodString;
177
+ fallback: z.ZodString;
178
+ }, 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
+ }>>;
328
+ id: z.ZodOptional<z.ZodString>;
329
+ name: z.ZodOptional<z.ZodString>;
330
+ }, z.core.$strip>, z.ZodTransform<{
331
+ page: {
332
+ print: {
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" | {
334
+ width: number;
335
+ height: number;
336
+ unit: "in" | "mm" | "pt";
337
+ };
338
+ orientation: "portrait" | "landscape";
339
+ bleed: number;
340
+ safe: number;
341
+ marks: boolean;
342
+ markColor: "black" | "registration";
343
+ margin?: {
344
+ top: number;
345
+ right: number;
346
+ bottom: number;
347
+ left: number;
348
+ } | undefined;
349
+ };
350
+ body: PageBody;
351
+ size: {
352
+ width: number;
353
+ height: number;
354
+ } | {
355
+ readonly width: "full";
356
+ readonly height: "auto";
357
+ } | {
358
+ width: number | "full" | "standard" | "wide";
359
+ height: "auto";
360
+ };
361
+ scripts: "refuse" | "sandboxed";
362
+ id?: string | undefined;
363
+ dir?: "auto" | "ltr" | "rtl" | undefined;
364
+ lang?: string | undefined;
365
+ printedPages?: {
366
+ parents: {
367
+ name: string;
368
+ basedOn?: string | undefined;
369
+ margin?: {
370
+ top: number;
371
+ bottom: number;
372
+ inner: number;
373
+ outer: number;
374
+ } | undefined;
375
+ head?: string | undefined;
376
+ foot?: string | undefined;
377
+ }[];
378
+ rules: {
379
+ last?: string | undefined;
380
+ verso?: string | undefined;
381
+ recto?: string | undefined;
382
+ first?: string | undefined;
383
+ every: string;
384
+ };
385
+ numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
386
+ } | undefined;
387
+ slots?: {
388
+ key: string;
389
+ label: string;
390
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
391
+ required: boolean;
392
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
393
+ placeholder?: string | undefined;
394
+ minSize?: number | undefined;
395
+ }[] | undefined;
396
+ fonts?: ({
397
+ app: string;
398
+ } | {
399
+ local: string;
400
+ fallback: string;
401
+ })[] | undefined;
402
+ };
403
+ id?: string | undefined;
404
+ name?: string | undefined;
405
+ }, {
406
+ page: {
407
+ body: PageBody;
408
+ size: {
409
+ width: number;
410
+ height: number;
411
+ } | {
412
+ readonly width: "full";
413
+ readonly height: "auto";
414
+ } | {
415
+ width: number | "full" | "standard" | "wide";
416
+ height: "auto";
417
+ };
418
+ scripts: "refuse" | "sandboxed";
419
+ id?: string | undefined;
420
+ dir?: "auto" | "ltr" | "rtl" | undefined;
421
+ lang?: string | undefined;
422
+ print?: {
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" | {
424
+ width: number;
425
+ height: number;
426
+ unit: "in" | "mm" | "pt";
427
+ };
428
+ orientation: "portrait" | "landscape";
429
+ bleed: number;
430
+ safe: number;
431
+ marks: boolean;
432
+ markColor: "black" | "registration";
433
+ margin?: {
434
+ top: number;
435
+ right: number;
436
+ bottom: number;
437
+ left: number;
438
+ } | undefined;
439
+ } | undefined;
440
+ printedPages?: {
441
+ parents: {
442
+ name: string;
443
+ basedOn?: string | undefined;
444
+ margin?: {
445
+ top: number;
446
+ bottom: number;
447
+ inner: number;
448
+ outer: number;
449
+ } | undefined;
450
+ head?: string | undefined;
451
+ foot?: string | undefined;
452
+ }[];
453
+ rules: {
454
+ last?: string | undefined;
455
+ verso?: string | undefined;
456
+ recto?: string | undefined;
457
+ first?: string | undefined;
458
+ every: string;
459
+ };
460
+ numbering?: "arabic" | "roman-lower" | "roman-upper" | "hebrew" | undefined;
461
+ } | undefined;
462
+ slots?: {
463
+ key: string;
464
+ label: string;
465
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
466
+ required: boolean;
467
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
468
+ placeholder?: string | undefined;
469
+ minSize?: number | undefined;
470
+ }[] | undefined;
471
+ fonts?: ({
472
+ app: string;
473
+ } | {
474
+ local: string;
475
+ fallback: string;
476
+ })[] | undefined;
477
+ };
478
+ id?: string | undefined;
479
+ name?: string | undefined;
480
+ }>>;
481
+ export type Cover = z.infer<typeof Cover>;
482
+ export type CoverInput = z.input<typeof Cover>;
483
+ export interface CoverDigestMaterial {
484
+ page: Page;
485
+ sheet: {
486
+ width: number;
487
+ height: number;
488
+ };
489
+ drawingVersion: number;
490
+ stamp: string;
491
+ fonts: readonly string[];
492
+ motifs: readonly Motif[];
493
+ }
494
+ export declare function digestCoverMaterial(material: CoverDigestMaterial): Promise<string>;
495
+ export declare function coverDigest(cover: Cover, inputs: {
496
+ stamp: string;
497
+ fonts?: readonly string[];
498
+ motifs?: readonly Motif[];
499
+ }): Promise<string>;
500
+ //#endregion
package/dist/cover.js ADDED
@@ -0,0 +1,100 @@
1
+ import { sheetMm } from "./paper.js";
2
+ import { Print } from "./print.js";
3
+ import { Page } from "./page.js";
4
+ import { z } from "zod";
5
+ //#region src/cover.ts
6
+ const COVER_SHEET = {
7
+ width: 160,
8
+ height: 100
9
+ };
10
+ const COVER_DRAWING_VERSION = 1;
11
+ const COVER_PRINT = {
12
+ paper: {
13
+ width: COVER_SHEET.width,
14
+ height: COVER_SHEET.height,
15
+ unit: "mm"
16
+ },
17
+ orientation: "landscape"
18
+ };
19
+ const Cover = z.object({
20
+ page: Page,
21
+ id: z.string().optional(),
22
+ name: z.string().optional()
23
+ }).transform((cover) => ({
24
+ ...cover,
25
+ page: {
26
+ ...cover.page,
27
+ print: cover.page.print ?? Print.parse(COVER_PRINT)
28
+ }
29
+ })).superRefine((cover, ctx) => {
30
+ const print = cover.page.print;
31
+ if (print.bleed !== 0) ctx.addIssue({
32
+ code: "custom",
33
+ path: [
34
+ "page",
35
+ "print",
36
+ "bleed"
37
+ ],
38
+ message: "page.print.bleed must be 0; remove bleed from the cover"
39
+ });
40
+ if (print.safe !== 0) ctx.addIssue({
41
+ code: "custom",
42
+ path: [
43
+ "page",
44
+ "print",
45
+ "safe"
46
+ ],
47
+ message: "page.print.safe must be 0; remove the safe area from the cover"
48
+ });
49
+ if (print.marks) ctx.addIssue({
50
+ code: "custom",
51
+ path: [
52
+ "page",
53
+ "print",
54
+ "marks"
55
+ ],
56
+ message: "page.print.marks must be false; remove marks from the cover"
57
+ });
58
+ if (cover.page.scripts !== "refuse") ctx.addIssue({
59
+ code: "custom",
60
+ path: ["page", "scripts"],
61
+ message: "page.scripts must be 'refuse'; refuse scripts on the cover"
62
+ });
63
+ });
64
+ function canonicalValue(value) {
65
+ if (Array.isArray(value)) return value.filter((item) => item !== void 0).map(canonicalValue);
66
+ if (value === null || typeof value !== "object") return value;
67
+ return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0).sort(([left], [right]) => compareText(left, right)).map(([key, entry]) => [key, canonicalValue(entry)]));
68
+ }
69
+ function compareText(left, right) {
70
+ return left < right ? -1 : left > right ? 1 : 0;
71
+ }
72
+ function canonicalJson(value) {
73
+ return JSON.stringify(canonicalValue(value));
74
+ }
75
+ function orderedMotifs(motifs) {
76
+ return [...motifs].sort((left, right) => compareText(left.key, right.key) || compareText(left.revision, right.revision) || compareText(canonicalJson(left), canonicalJson(right)));
77
+ }
78
+ async function digestCoverMaterial(material) {
79
+ const { id: _pageId, ...page } = material.page;
80
+ const canonical = canonicalJson({
81
+ ...material,
82
+ page,
83
+ fonts: [...material.fonts].sort(),
84
+ motifs: orderedMotifs(material.motifs)
85
+ });
86
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(canonical));
87
+ return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
88
+ }
89
+ function coverDigest(cover, inputs) {
90
+ return digestCoverMaterial({
91
+ page: cover.page,
92
+ sheet: sheetMm(cover.page.print),
93
+ drawingVersion: 1,
94
+ stamp: inputs.stamp,
95
+ fonts: inputs.fonts ?? [],
96
+ motifs: inputs.motifs ?? []
97
+ });
98
+ }
99
+ //#endregion
100
+ export { COVER_DRAWING_VERSION, COVER_SHEET, Cover, coverDigest, digestCoverMaterial };
@@ -88,6 +88,25 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
88
88
  alt: string;
89
89
  fit?: "width" | "contain" | "cover" | "focus" | undefined;
90
90
  frame?: boolean | undefined;
91
+ } | {
92
+ media: {
93
+ kind: "deck" | "page" | "paper" | "book" | "media" | "shot";
94
+ address: string;
95
+ page?: string | number | undefined;
96
+ box?: "media" | "crop" | "trim" | "bleed" | "art" | undefined;
97
+ crop?: {
98
+ top?: string | undefined;
99
+ right?: string | undefined;
100
+ bottom?: string | undefined;
101
+ left?: string | undefined;
102
+ } | undefined;
103
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
104
+ alt?: {
105
+ text: string;
106
+ lang?: string | undefined;
107
+ dir?: "auto" | "ltr" | "rtl" | undefined;
108
+ } | undefined;
109
+ };
91
110
  };
92
111
  notes?: string | undefined;
93
112
  narration?: {
@@ -106,7 +125,7 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
106
125
  untilWord?: number | undefined;
107
126
  }[];
108
127
  lang?: string | undefined;
109
- dir?: "ltr" | "rtl" | "auto" | undefined;
128
+ dir?: "auto" | "ltr" | "rtl" | undefined;
110
129
  voice?: string | undefined;
111
130
  } | undefined;
112
131
  beforeMs?: number | undefined;
@@ -114,18 +133,18 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
114
133
  holdMs?: number | undefined;
115
134
  printAtMs?: number | undefined;
116
135
  }[];
117
- dir?: "ltr" | "rtl" | "auto" | undefined;
136
+ dir?: "auto" | "ltr" | "rtl" | undefined;
118
137
  lang?: string | undefined;
119
138
  transition?: {
120
139
  kind: "none" | "fade" | "slide";
121
140
  duration: number;
122
141
  } | undefined;
123
- playback?: "continuous" | "segmented" | undefined;
142
+ playback?: "segmented" | "continuous" | undefined;
124
143
  captions?: "on" | "off" | "viewer" | undefined;
125
144
  slots?: {
126
145
  key: string;
127
146
  label: string;
128
- type: "text" | "phone" | "email" | "link" | "qr" | "image";
147
+ type: "text" | "image" | "phone" | "email" | "link" | "qr";
129
148
  required: boolean;
130
149
  overflow: "refuse" | "shrink" | "truncate" | "wrap";
131
150
  placeholder?: string | undefined;