@segnavia/format 0.7.0 → 0.8.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,8 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
18
18
  width: number;
19
19
  height: number;
20
20
  };
21
+ fit: "width" | "contain" | "cover" | "focus";
22
+ frame: boolean;
21
23
  scripts: "refuse" | "sandboxed";
22
24
  slides: {
23
25
  id: string;
@@ -72,13 +74,19 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
72
74
  capturedAt: string;
73
75
  meta: Record<string, unknown>;
74
76
  };
77
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
78
+ frame?: boolean | undefined;
75
79
  } | {
76
80
  kind: "shot-ref";
77
81
  href: string;
82
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
83
+ frame?: boolean | undefined;
78
84
  } | {
79
85
  kind: "image";
80
86
  src: string;
81
87
  alt: string;
88
+ fit?: "width" | "contain" | "cover" | "focus" | undefined;
89
+ frame?: boolean | undefined;
82
90
  };
83
91
  notes?: string | undefined;
84
92
  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,13 @@ export declare const Deck: z.ZodObject<{
342
391
  width: z.ZodNumber;
343
392
  height: z.ZodNumber;
344
393
  }, z.core.$strip>>;
394
+ fit: z.ZodDefault<z.ZodEnum<{
395
+ width: "width";
396
+ contain: "contain";
397
+ cover: "cover";
398
+ focus: "focus";
399
+ }>>;
400
+ frame: z.ZodDefault<z.ZodBoolean>;
345
401
  scripts: z.ZodDefault<z.ZodEnum<{
346
402
  refuse: "refuse";
347
403
  sandboxed: "sandboxed";
@@ -425,13 +481,34 @@ export declare const Deck: z.ZodObject<{
425
481
  capturedAt: z.ZodString;
426
482
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
427
483
  }, z.core.$strip>;
484
+ fit: z.ZodOptional<z.ZodEnum<{
485
+ width: "width";
486
+ contain: "contain";
487
+ cover: "cover";
488
+ focus: "focus";
489
+ }>>;
490
+ frame: z.ZodOptional<z.ZodBoolean>;
428
491
  }, z.core.$strip>, z.ZodObject<{
429
492
  kind: z.ZodLiteral<"shot-ref">;
430
493
  href: z.ZodString;
494
+ fit: z.ZodOptional<z.ZodEnum<{
495
+ width: "width";
496
+ contain: "contain";
497
+ cover: "cover";
498
+ focus: "focus";
499
+ }>>;
500
+ frame: z.ZodOptional<z.ZodBoolean>;
431
501
  }, z.core.$strip>, z.ZodObject<{
432
502
  kind: z.ZodLiteral<"image">;
433
503
  src: z.ZodString;
434
504
  alt: z.ZodString;
505
+ fit: z.ZodOptional<z.ZodEnum<{
506
+ width: "width";
507
+ contain: "contain";
508
+ cover: "cover";
509
+ focus: "focus";
510
+ }>>;
511
+ frame: z.ZodOptional<z.ZodBoolean>;
435
512
  }, z.core.$strip>], "kind">;
436
513
  notes: z.ZodOptional<z.ZodString>;
437
514
  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,8 @@ const DECK_SIZE = {
110
122
  const DeckShape = z.object({
111
123
  title: z.string(),
112
124
  size: Size.default(DECK_SIZE),
125
+ fit: ImageFit.default("contain"),
126
+ frame: z.boolean().default(false),
113
127
  scripts: Scripts.default("refuse"),
114
128
  dir: Direction.optional(),
115
129
  lang: z.string().optional(),
@@ -193,4 +207,4 @@ function exceedsLimits(deck, limits) {
193
207
  return reasons;
194
208
  }
195
209
  //#endregion
196
- export { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits };
210
+ 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,13 @@ export declare function jsonSchemas(): {
428
428
  width: z.ZodNumber;
429
429
  height: z.ZodNumber;
430
430
  }, z.core.$strip>>;
431
+ fit: z.ZodDefault<z.ZodEnum<{
432
+ width: "width";
433
+ contain: "contain";
434
+ cover: "cover";
435
+ focus: "focus";
436
+ }>>;
437
+ frame: z.ZodDefault<z.ZodBoolean>;
431
438
  scripts: z.ZodDefault<z.ZodEnum<{
432
439
  refuse: "refuse";
433
440
  sandboxed: "sandboxed";
@@ -511,13 +518,34 @@ export declare function jsonSchemas(): {
511
518
  capturedAt: z.ZodString;
512
519
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
513
520
  }, z.core.$strip>;
521
+ fit: z.ZodOptional<z.ZodEnum<{
522
+ width: "width";
523
+ contain: "contain";
524
+ cover: "cover";
525
+ focus: "focus";
526
+ }>>;
527
+ frame: z.ZodOptional<z.ZodBoolean>;
514
528
  }, z.core.$strip>, z.ZodObject<{
515
529
  kind: z.ZodLiteral<"shot-ref">;
516
530
  href: z.ZodString;
531
+ fit: z.ZodOptional<z.ZodEnum<{
532
+ width: "width";
533
+ contain: "contain";
534
+ cover: "cover";
535
+ focus: "focus";
536
+ }>>;
537
+ frame: z.ZodOptional<z.ZodBoolean>;
517
538
  }, z.core.$strip>, z.ZodObject<{
518
539
  kind: z.ZodLiteral<"image">;
519
540
  src: z.ZodString;
520
541
  alt: z.ZodString;
542
+ fit: z.ZodOptional<z.ZodEnum<{
543
+ width: "width";
544
+ contain: "contain";
545
+ cover: "cover";
546
+ focus: "focus";
547
+ }>>;
548
+ frame: z.ZodOptional<z.ZodBoolean>;
521
549
  }, z.core.$strip>], "kind">;
522
550
  notes: z.ZodOptional<z.ZodString>;
523
551
  narration: z.ZodOptional<z.ZodObject<{
@@ -646,4 +674,4 @@ export declare function jsonSchemas(): {
646
674
  }, z.core.$strip>>;
647
675
  };
648
676
  //#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 };
677
+ 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.8.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {