@segnavia/format 0.7.0 → 0.9.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.
@@ -18,6 +18,9 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
18
18
  width: number;
19
19
  height: number;
20
20
  };
21
+ layout: "fixed" | "responsive";
22
+ fit: "width" | "contain" | "cover" | "focus";
23
+ frame: boolean;
21
24
  scripts: "refuse" | "sandboxed";
22
25
  slides: {
23
26
  id: string;
@@ -72,13 +75,19 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
72
75
  capturedAt: string;
73
76
  meta: Record<string, unknown>;
74
77
  };
78
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
79
+ frame?: boolean | undefined;
75
80
  } | {
76
81
  kind: "shot-ref";
77
82
  href: string;
83
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
84
+ frame?: boolean | undefined;
78
85
  } | {
79
86
  kind: "image";
80
87
  src: string;
81
88
  alt: string;
89
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
90
+ frame?: boolean | undefined;
82
91
  };
83
92
  notes?: string | undefined;
84
93
  narration?: {
@@ -23,7 +23,9 @@ function deckFromSlides(rows, options) {
23
23
  content: {
24
24
  kind,
25
25
  src: row.src,
26
- shot: row.shot
26
+ shot: row.shot,
27
+ ...row.fit !== void 0 ? { fit: row.fit } : {},
28
+ ...row.frame !== void 0 ? { frame: row.frame } : {}
27
29
  }
28
30
  };
29
31
  });
package/dist/deck.d.ts CHANGED
@@ -16,6 +16,13 @@ export declare const Point: z.ZodObject<{
16
16
  x: z.ZodNumber;
17
17
  y: z.ZodNumber;
18
18
  }, z.core.$strip>;
19
+ export declare const ImageFit: z.ZodEnum<{
20
+ width: "width";
21
+ contain: "contain";
22
+ cover: "cover";
23
+ focus: "focus";
24
+ }>;
25
+ export type ImageFit = z.infer<typeof ImageFit>;
19
26
  export declare const Annotation: z.ZodObject<{
20
27
  ring: z.ZodNullable<z.ZodObject<{
21
28
  x: z.ZodNumber;
@@ -229,13 +236,34 @@ export declare const SlideContent: z.ZodDiscriminatedUnion<[z.ZodObject<{
229
236
  capturedAt: z.ZodString;
230
237
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
231
238
  }, z.core.$strip>;
239
+ fit: z.ZodOptional<z.ZodEnum<{
240
+ width: "width";
241
+ contain: "contain";
242
+ cover: "cover";
243
+ focus: "focus";
244
+ }>>;
245
+ frame: z.ZodOptional<z.ZodBoolean>;
232
246
  }, z.core.$strip>, z.ZodObject<{
233
247
  kind: z.ZodLiteral<"shot-ref">;
234
248
  href: z.ZodString;
249
+ fit: z.ZodOptional<z.ZodEnum<{
250
+ width: "width";
251
+ contain: "contain";
252
+ cover: "cover";
253
+ focus: "focus";
254
+ }>>;
255
+ frame: z.ZodOptional<z.ZodBoolean>;
235
256
  }, z.core.$strip>, z.ZodObject<{
236
257
  kind: z.ZodLiteral<"image">;
237
258
  src: z.ZodString;
238
259
  alt: z.ZodString;
260
+ fit: z.ZodOptional<z.ZodEnum<{
261
+ width: "width";
262
+ contain: "contain";
263
+ cover: "cover";
264
+ focus: "focus";
265
+ }>>;
266
+ frame: z.ZodOptional<z.ZodBoolean>;
239
267
  }, z.core.$strip>], "kind">;
240
268
  export type SlideContent = z.infer<typeof SlideContent>;
241
269
  export declare const Slide: z.ZodObject<{
@@ -294,13 +322,34 @@ export declare const Slide: z.ZodObject<{
294
322
  capturedAt: z.ZodString;
295
323
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
296
324
  }, z.core.$strip>;
325
+ fit: z.ZodOptional<z.ZodEnum<{
326
+ width: "width";
327
+ contain: "contain";
328
+ cover: "cover";
329
+ focus: "focus";
330
+ }>>;
331
+ frame: z.ZodOptional<z.ZodBoolean>;
297
332
  }, z.core.$strip>, z.ZodObject<{
298
333
  kind: z.ZodLiteral<"shot-ref">;
299
334
  href: z.ZodString;
335
+ fit: z.ZodOptional<z.ZodEnum<{
336
+ width: "width";
337
+ contain: "contain";
338
+ cover: "cover";
339
+ focus: "focus";
340
+ }>>;
341
+ frame: z.ZodOptional<z.ZodBoolean>;
300
342
  }, z.core.$strip>, z.ZodObject<{
301
343
  kind: z.ZodLiteral<"image">;
302
344
  src: z.ZodString;
303
345
  alt: z.ZodString;
346
+ fit: z.ZodOptional<z.ZodEnum<{
347
+ width: "width";
348
+ contain: "contain";
349
+ cover: "cover";
350
+ focus: "focus";
351
+ }>>;
352
+ frame: z.ZodOptional<z.ZodBoolean>;
304
353
  }, z.core.$strip>], "kind">;
305
354
  notes: z.ZodOptional<z.ZodString>;
306
355
  narration: z.ZodOptional<z.ZodObject<{
@@ -342,6 +391,17 @@ export declare const Deck: z.ZodObject<{
342
391
  width: z.ZodNumber;
343
392
  height: z.ZodNumber;
344
393
  }, z.core.$strip>>;
394
+ layout: z.ZodDefault<z.ZodEnum<{
395
+ fixed: "fixed";
396
+ responsive: "responsive";
397
+ }>>;
398
+ fit: z.ZodDefault<z.ZodEnum<{
399
+ width: "width";
400
+ contain: "contain";
401
+ cover: "cover";
402
+ focus: "focus";
403
+ }>>;
404
+ frame: z.ZodDefault<z.ZodBoolean>;
345
405
  scripts: z.ZodDefault<z.ZodEnum<{
346
406
  refuse: "refuse";
347
407
  sandboxed: "sandboxed";
@@ -425,13 +485,34 @@ export declare const Deck: z.ZodObject<{
425
485
  capturedAt: z.ZodString;
426
486
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
427
487
  }, z.core.$strip>;
488
+ fit: z.ZodOptional<z.ZodEnum<{
489
+ width: "width";
490
+ contain: "contain";
491
+ cover: "cover";
492
+ focus: "focus";
493
+ }>>;
494
+ frame: z.ZodOptional<z.ZodBoolean>;
428
495
  }, z.core.$strip>, z.ZodObject<{
429
496
  kind: z.ZodLiteral<"shot-ref">;
430
497
  href: z.ZodString;
498
+ fit: z.ZodOptional<z.ZodEnum<{
499
+ width: "width";
500
+ contain: "contain";
501
+ cover: "cover";
502
+ focus: "focus";
503
+ }>>;
504
+ frame: z.ZodOptional<z.ZodBoolean>;
431
505
  }, z.core.$strip>, z.ZodObject<{
432
506
  kind: z.ZodLiteral<"image">;
433
507
  src: z.ZodString;
434
508
  alt: z.ZodString;
509
+ fit: z.ZodOptional<z.ZodEnum<{
510
+ width: "width";
511
+ contain: "contain";
512
+ cover: "cover";
513
+ focus: "focus";
514
+ }>>;
515
+ frame: z.ZodOptional<z.ZodBoolean>;
435
516
  }, z.core.$strip>], "kind">;
436
517
  notes: z.ZodOptional<z.ZodString>;
437
518
  narration: z.ZodOptional<z.ZodObject<{
package/dist/deck.js CHANGED
@@ -18,6 +18,12 @@ const Point = z.object({
18
18
  x: z.number(),
19
19
  y: z.number()
20
20
  });
21
+ const ImageFit = z.enum([
22
+ "contain",
23
+ "cover",
24
+ "width",
25
+ "focus"
26
+ ]);
21
27
  const Annotation = z.object({
22
28
  ring: Box.nullable(),
23
29
  badge: z.object({
@@ -82,16 +88,22 @@ const SlideContent = z.discriminatedUnion("kind", [
82
88
  z.object({
83
89
  kind: z.literal("shot"),
84
90
  src: z.string(),
85
- shot: Shot
91
+ shot: Shot,
92
+ fit: ImageFit.optional(),
93
+ frame: z.boolean().optional()
86
94
  }),
87
95
  z.object({
88
96
  kind: z.literal("shot-ref"),
89
- href: z.string()
97
+ href: z.string(),
98
+ fit: ImageFit.optional(),
99
+ frame: z.boolean().optional()
90
100
  }),
91
101
  z.object({
92
102
  kind: z.literal("image"),
93
103
  src: z.string(),
94
- alt: z.string()
104
+ alt: z.string(),
105
+ fit: ImageFit.optional(),
106
+ frame: z.boolean().optional()
95
107
  })
96
108
  ]);
97
109
  const Slide = z.object({
@@ -110,6 +122,9 @@ const DECK_SIZE = {
110
122
  const DeckShape = z.object({
111
123
  title: z.string(),
112
124
  size: Size.default(DECK_SIZE),
125
+ layout: z.enum(["fixed", "responsive"]).default("fixed"),
126
+ fit: ImageFit.default("contain"),
127
+ frame: z.boolean().default(false),
113
128
  scripts: Scripts.default("refuse"),
114
129
  dir: Direction.optional(),
115
130
  lang: z.string().optional(),
@@ -193,4 +208,4 @@ function exceedsLimits(deck, limits) {
193
208
  return reasons;
194
209
  }
195
210
  //#endregion
196
- export { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits };
211
+ export { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, ImageFit, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Book, BookContents, BookFrontMatterEntry, BookInput, BookMode, BookPage, BookSection, BookView, BookViewInput, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
2
- import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckInput, DeckLimits, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
2
+ import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckInput, DeckLimits, ImageFit, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
3
3
  import { DeckFromSlidesOptions, SlideRow, deckFromSlides } from "./deck-from-slides.js";
4
4
  import { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection } from "./direction.js";
5
5
  import { MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, NAMED_PAPERS, PAPER_MM, PX_PER_MM, Paper, PaperBox, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
@@ -428,6 +428,17 @@ export declare function jsonSchemas(): {
428
428
  width: z.ZodNumber;
429
429
  height: z.ZodNumber;
430
430
  }, z.core.$strip>>;
431
+ layout: z.ZodDefault<z.ZodEnum<{
432
+ fixed: "fixed";
433
+ responsive: "responsive";
434
+ }>>;
435
+ fit: z.ZodDefault<z.ZodEnum<{
436
+ width: "width";
437
+ contain: "contain";
438
+ cover: "cover";
439
+ focus: "focus";
440
+ }>>;
441
+ frame: z.ZodDefault<z.ZodBoolean>;
431
442
  scripts: z.ZodDefault<z.ZodEnum<{
432
443
  refuse: "refuse";
433
444
  sandboxed: "sandboxed";
@@ -511,13 +522,34 @@ export declare function jsonSchemas(): {
511
522
  capturedAt: z.ZodString;
512
523
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
513
524
  }, z.core.$strip>;
525
+ fit: z.ZodOptional<z.ZodEnum<{
526
+ width: "width";
527
+ contain: "contain";
528
+ cover: "cover";
529
+ focus: "focus";
530
+ }>>;
531
+ frame: z.ZodOptional<z.ZodBoolean>;
514
532
  }, z.core.$strip>, z.ZodObject<{
515
533
  kind: z.ZodLiteral<"shot-ref">;
516
534
  href: z.ZodString;
535
+ fit: z.ZodOptional<z.ZodEnum<{
536
+ width: "width";
537
+ contain: "contain";
538
+ cover: "cover";
539
+ focus: "focus";
540
+ }>>;
541
+ frame: z.ZodOptional<z.ZodBoolean>;
517
542
  }, z.core.$strip>, z.ZodObject<{
518
543
  kind: z.ZodLiteral<"image">;
519
544
  src: z.ZodString;
520
545
  alt: z.ZodString;
546
+ fit: z.ZodOptional<z.ZodEnum<{
547
+ width: "width";
548
+ contain: "contain";
549
+ cover: "cover";
550
+ focus: "focus";
551
+ }>>;
552
+ frame: z.ZodOptional<z.ZodBoolean>;
521
553
  }, z.core.$strip>], "kind">;
522
554
  notes: z.ZodOptional<z.ZodString>;
523
555
  narration: z.ZodOptional<z.ZodObject<{
@@ -646,4 +678,4 @@ export declare function jsonSchemas(): {
646
678
  }, z.core.$strip>>;
647
679
  };
648
680
  //#endregion
649
- export { Annotation, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, type Imposed, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type Placement, Point, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, type TextDirection, Transition, TransitionInput, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
681
+ export { Annotation, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, ImageFit, type Imposed, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type Placement, Point, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, type TextDirection, Transition, TransitionInput, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { Scripts } from "./scripts.js";
5
5
  import { Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookShape, BookView, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
6
6
  import { MAX_SLIDE_TIMING_MS } from "./timing.js";
7
7
  import { DEFAULT_TRANSITION_DURATION_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, Transition } from "./transition.js";
8
- import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
8
+ import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, ImageFit, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
9
9
  import { Lexicon, PronunciationEntry, lexiconVersion } from "./lexicon.js";
10
10
  import { deckFromSlides } from "./deck-from-slides.js";
11
11
  import { fitPage, impose, mirrorPlacement, pagePlacementLayout } from "./imposition.js";
@@ -151,4 +151,4 @@ function jsonSchemas() {
151
151
  };
152
152
  }
153
153
  //#endregion
154
- export { Annotation, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, Imposition, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, Page, PageSize, Paper, Point, Print, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, Size, Slide, SlideContent, Transition, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, jsonSchemas, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
154
+ export { Annotation, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, ImageFit, Imposition, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, Page, PageSize, Paper, Point, Print, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, Size, Slide, SlideContent, Transition, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, jsonSchemas, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segnavia/format",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {