@segnavia/format 0.21.0 → 0.23.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.
package/dist/board.d.ts CHANGED
@@ -4,10 +4,10 @@ export declare const BoardItem: z.ZodObject<{
4
4
  id: z.ZodString;
5
5
  kind: z.ZodEnum<{
6
6
  paper: "paper";
7
+ image: "image";
7
8
  page: "page";
8
9
  book: "book";
9
10
  shot: "shot";
10
- image: "image";
11
11
  deck: "deck";
12
12
  }>;
13
13
  address: z.ZodString;
@@ -60,10 +60,10 @@ export declare const Board: z.ZodObject<{
60
60
  id: z.ZodString;
61
61
  kind: z.ZodEnum<{
62
62
  paper: "paper";
63
+ image: "image";
63
64
  page: "page";
64
65
  book: "book";
65
66
  shot: "shot";
66
- image: "image";
67
67
  deck: "deck";
68
68
  }>;
69
69
  address: z.ZodString;
@@ -122,5 +122,14 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
122
122
  } | undefined;
123
123
  playback?: "continuous" | "segmented" | undefined;
124
124
  captions?: "on" | "off" | "viewer" | undefined;
125
+ slots?: {
126
+ key: string;
127
+ label: string;
128
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
129
+ required: boolean;
130
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
131
+ placeholder?: string | undefined;
132
+ minSize?: number | undefined;
133
+ }[] | undefined;
125
134
  };
126
135
  //#endregion
package/dist/deck.d.ts CHANGED
@@ -438,6 +438,43 @@ export declare const Deck: z.ZodObject<{
438
438
  off: "off";
439
439
  viewer: "viewer";
440
440
  }>>;
441
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
442
+ key: z.ZodString;
443
+ label: z.ZodString;
444
+ type: z.ZodEnum<{
445
+ text: "text";
446
+ phone: "phone";
447
+ email: "email";
448
+ link: "link";
449
+ qr: "qr";
450
+ image: "image";
451
+ }>;
452
+ required: z.ZodDefault<z.ZodBoolean>;
453
+ placeholder: z.ZodOptional<z.ZodString>;
454
+ overflow: z.ZodDefault<z.ZodEnum<{
455
+ refuse: "refuse";
456
+ shrink: "shrink";
457
+ truncate: "truncate";
458
+ wrap: "wrap";
459
+ }>>;
460
+ minSize: z.ZodOptional<z.ZodNumber>;
461
+ }, z.core.$strip>, z.ZodTransform<{
462
+ key: string;
463
+ label: string;
464
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
465
+ required: boolean;
466
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
467
+ placeholder?: string | undefined;
468
+ minSize?: number | undefined;
469
+ }, {
470
+ key: string;
471
+ label: string;
472
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
473
+ required: boolean;
474
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
475
+ placeholder?: string | undefined;
476
+ minSize?: number | undefined;
477
+ }>>>>;
441
478
  slides: z.ZodArray<z.ZodObject<{
442
479
  id: z.ZodString;
443
480
  content: z.ZodDiscriminatedUnion<[z.ZodObject<{
package/dist/deck.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Direction } from "./direction.js";
2
2
  import { Scripts } from "./scripts.js";
3
+ import { Slots } from "./slots.js";
3
4
  import { SlideTiming, slideTimingIssues } from "./timing.js";
4
5
  import { Transition } from "./transition.js";
5
6
  import { z } from "zod";
@@ -142,6 +143,7 @@ const DeckShape = z.object({
142
143
  "off",
143
144
  "viewer"
144
145
  ]).optional(),
146
+ slots: Slots.optional(),
145
147
  slides: z.array(Slide).min(1)
146
148
  });
147
149
  function annotationCueIssues(narration, annotations) {
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ import { Scripts } from "./scripts.js";
17
17
  import { ShotUse, shotsUsed } from "./shots-used.js";
18
18
  import { MAX_SLIDE_TIMING_MS } from "./timing.js";
19
19
  import { DEFAULT_TRANSITION_DURATION_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, Transition, TransitionInput } from "./transition.js";
20
+ import { Fill, SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, mergeSlotDeclarations } from "./slots.js";
20
21
  import { z } from "zod";
21
22
  //#region src/index.d.ts
22
23
  export declare const Margin: z.ZodObject<{
@@ -249,6 +250,43 @@ export declare const Page: z.ZodObject<{
249
250
  safe: z.ZodDefault<z.ZodNumber>;
250
251
  marks: z.ZodDefault<z.ZodBoolean>;
251
252
  }, z.core.$strip>>;
253
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
254
+ key: z.ZodString;
255
+ label: z.ZodString;
256
+ type: z.ZodEnum<{
257
+ text: "text";
258
+ phone: "phone";
259
+ email: "email";
260
+ link: "link";
261
+ qr: "qr";
262
+ image: "image";
263
+ }>;
264
+ required: z.ZodDefault<z.ZodBoolean>;
265
+ placeholder: z.ZodOptional<z.ZodString>;
266
+ overflow: z.ZodDefault<z.ZodEnum<{
267
+ refuse: "refuse";
268
+ shrink: "shrink";
269
+ truncate: "truncate";
270
+ wrap: "wrap";
271
+ }>>;
272
+ minSize: z.ZodOptional<z.ZodNumber>;
273
+ }, z.core.$strip>, z.ZodTransform<{
274
+ key: string;
275
+ label: string;
276
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
277
+ required: boolean;
278
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
279
+ placeholder?: string | undefined;
280
+ minSize?: number | undefined;
281
+ }, {
282
+ key: string;
283
+ label: string;
284
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
285
+ required: boolean;
286
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
287
+ placeholder?: string | undefined;
288
+ minSize?: number | undefined;
289
+ }>>>>;
252
290
  }, z.core.$strip>;
253
291
  export type Page = z.infer<typeof Page>;
254
292
  export type PageInput = z.input<typeof Page>;
@@ -462,6 +500,43 @@ export declare function jsonSchemas(): {
462
500
  safe: z.ZodDefault<z.ZodNumber>;
463
501
  marks: z.ZodDefault<z.ZodBoolean>;
464
502
  }, z.core.$strip>>;
503
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
504
+ key: z.ZodString;
505
+ label: z.ZodString;
506
+ type: z.ZodEnum<{
507
+ text: "text";
508
+ phone: "phone";
509
+ email: "email";
510
+ link: "link";
511
+ qr: "qr";
512
+ image: "image";
513
+ }>;
514
+ required: z.ZodDefault<z.ZodBoolean>;
515
+ placeholder: z.ZodOptional<z.ZodString>;
516
+ overflow: z.ZodDefault<z.ZodEnum<{
517
+ refuse: "refuse";
518
+ shrink: "shrink";
519
+ truncate: "truncate";
520
+ wrap: "wrap";
521
+ }>>;
522
+ minSize: z.ZodOptional<z.ZodNumber>;
523
+ }, z.core.$strip>, z.ZodTransform<{
524
+ key: string;
525
+ label: string;
526
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
527
+ required: boolean;
528
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
529
+ placeholder?: string | undefined;
530
+ minSize?: number | undefined;
531
+ }, {
532
+ key: string;
533
+ label: string;
534
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
535
+ required: boolean;
536
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
537
+ placeholder?: string | undefined;
538
+ minSize?: number | undefined;
539
+ }>>>>;
465
540
  }, z.core.$strip>>;
466
541
  lexicon: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
467
542
  entries: z.ZodArray<z.ZodObject<{
@@ -601,6 +676,43 @@ export declare function jsonSchemas(): {
601
676
  off: "off";
602
677
  viewer: "viewer";
603
678
  }>>;
679
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
680
+ key: z.ZodString;
681
+ label: z.ZodString;
682
+ type: z.ZodEnum<{
683
+ text: "text";
684
+ phone: "phone";
685
+ email: "email";
686
+ link: "link";
687
+ qr: "qr";
688
+ image: "image";
689
+ }>;
690
+ required: z.ZodDefault<z.ZodBoolean>;
691
+ placeholder: z.ZodOptional<z.ZodString>;
692
+ overflow: z.ZodDefault<z.ZodEnum<{
693
+ refuse: "refuse";
694
+ shrink: "shrink";
695
+ truncate: "truncate";
696
+ wrap: "wrap";
697
+ }>>;
698
+ minSize: z.ZodOptional<z.ZodNumber>;
699
+ }, z.core.$strip>, z.ZodTransform<{
700
+ key: string;
701
+ label: string;
702
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
703
+ required: boolean;
704
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
705
+ placeholder?: string | undefined;
706
+ minSize?: number | undefined;
707
+ }, {
708
+ key: string;
709
+ label: string;
710
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
711
+ required: boolean;
712
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
713
+ placeholder?: string | undefined;
714
+ minSize?: number | undefined;
715
+ }>>>>;
604
716
  slides: z.ZodArray<z.ZodObject<{
605
717
  id: z.ZodString;
606
718
  content: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -822,10 +934,10 @@ export declare function jsonSchemas(): {
822
934
  id: z.ZodString;
823
935
  kind: z.ZodEnum<{
824
936
  paper: "paper";
937
+ image: "image";
825
938
  page: "page";
826
939
  book: "book";
827
940
  shot: "shot";
828
- image: "image";
829
941
  deck: "deck";
830
942
  }>;
831
943
  address: z.ZodString;
@@ -946,6 +1058,80 @@ export declare function jsonSchemas(): {
946
1058
  landscape: "landscape";
947
1059
  }>;
948
1060
  }, z.core.$strict>>;
1061
+ slotDeclaration: z.core.ZodStandardJSONSchemaPayload<z.ZodPipe<z.ZodObject<{
1062
+ key: z.ZodString;
1063
+ label: z.ZodString;
1064
+ type: z.ZodEnum<{
1065
+ text: "text";
1066
+ phone: "phone";
1067
+ email: "email";
1068
+ link: "link";
1069
+ qr: "qr";
1070
+ image: "image";
1071
+ }>;
1072
+ required: z.ZodDefault<z.ZodBoolean>;
1073
+ placeholder: z.ZodOptional<z.ZodString>;
1074
+ overflow: z.ZodDefault<z.ZodEnum<{
1075
+ refuse: "refuse";
1076
+ shrink: "shrink";
1077
+ truncate: "truncate";
1078
+ wrap: "wrap";
1079
+ }>>;
1080
+ minSize: z.ZodOptional<z.ZodNumber>;
1081
+ }, z.core.$strip>, z.ZodTransform<{
1082
+ key: string;
1083
+ label: string;
1084
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
1085
+ required: boolean;
1086
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
1087
+ placeholder?: string | undefined;
1088
+ minSize?: number | undefined;
1089
+ }, {
1090
+ key: string;
1091
+ label: string;
1092
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
1093
+ required: boolean;
1094
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
1095
+ placeholder?: string | undefined;
1096
+ minSize?: number | undefined;
1097
+ }>>>;
1098
+ slotDeclarationInput: z.core.ZodStandardJSONSchemaPayload<z.ZodPipe<z.ZodObject<{
1099
+ key: z.ZodString;
1100
+ label: z.ZodString;
1101
+ type: z.ZodEnum<{
1102
+ text: "text";
1103
+ phone: "phone";
1104
+ email: "email";
1105
+ link: "link";
1106
+ qr: "qr";
1107
+ image: "image";
1108
+ }>;
1109
+ required: z.ZodDefault<z.ZodBoolean>;
1110
+ placeholder: z.ZodOptional<z.ZodString>;
1111
+ overflow: z.ZodDefault<z.ZodEnum<{
1112
+ refuse: "refuse";
1113
+ shrink: "shrink";
1114
+ truncate: "truncate";
1115
+ wrap: "wrap";
1116
+ }>>;
1117
+ minSize: z.ZodOptional<z.ZodNumber>;
1118
+ }, z.core.$strict>, z.ZodTransform<{
1119
+ key: string;
1120
+ label: string;
1121
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
1122
+ required: boolean;
1123
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
1124
+ placeholder?: string | undefined;
1125
+ minSize?: number | undefined;
1126
+ }, {
1127
+ key: string;
1128
+ label: string;
1129
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
1130
+ required: boolean;
1131
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
1132
+ placeholder?: string | undefined;
1133
+ minSize?: number | undefined;
1134
+ }>>>;
949
1135
  };
950
1136
  //#endregion
951
- export { Annotation, type ArrangeOptions, Board, type BoardInput, BoardItem, type BoardItemAnchor, BoardLabel, type BoardListingGroup, BoardSection, type BoardShapes, type BoardView, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, GridCell, type GridDropTarget, ImageFit, type Imposed, Lexicon, MAKE_ROOM_LIMIT, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ITEM_WIDTH, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, type NamedPaper, type NamedPaperMetadata, Narration, NoteMarker, NumberSystem, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type PaperGroup, PaperUnit, type Placement, Playback, type PlaybackMode, Point, PrintSetting, PrintSettingInput, PronunciationEntry, PublishedShot, SECTION_GAP, SECTION_MIN_SIZE, SECTION_PADDING, SECTION_TITLE_ROOM, SHOT_KEY, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, TextDirection, Transition, TransitionInput, Word, type ZoomBounds, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, foldForSearch, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, insertIntoGrid, isBookContents, isHebrew, itemAt, itemHeight, languageDirection, layoutSection, lexiconVersion, makeRoom, mirrorPlacement, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, parsePlayback, printBoxes, printPadding, printProperties, removeFromGrid, removeItems, resizeItem, resolveDirection, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
1137
+ export { Annotation, type ArrangeOptions, Board, type BoardInput, BoardItem, type BoardItemAnchor, BoardLabel, type BoardListingGroup, BoardSection, type BoardShapes, type BoardView, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, Fill, GridCell, type GridDropTarget, ImageFit, type Imposed, Lexicon, MAKE_ROOM_LIMIT, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ITEM_WIDTH, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, type NamedPaper, type NamedPaperMetadata, Narration, NoteMarker, NumberSystem, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type PaperGroup, PaperUnit, type Placement, Playback, type PlaybackMode, Point, PrintSetting, PrintSettingInput, PronunciationEntry, PublishedShot, SECTION_GAP, SECTION_MIN_SIZE, SECTION_PADDING, SECTION_TITLE_ROOM, SHOT_KEY, SLOT_TYPES, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, SlotDeclaration, SlotDeclarationInput, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, TextDirection, Transition, TransitionInput, Word, type ZoomBounds, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, foldForSearch, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, insertIntoGrid, isBookContents, isHebrew, itemAt, itemHeight, languageDirection, layoutSection, lexiconVersion, makeRoom, mergeSlotDeclarations, mirrorPlacement, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, parsePlayback, printBoxes, printPadding, printProperties, removeFromGrid, removeItems, resizeItem, resolveDirection, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection } from "./direction.js";
2
2
  import { Scripts } from "./scripts.js";
3
+ import { SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotType, Slots, SlotsInput, mergeSlotDeclarations } from "./slots.js";
3
4
  import { MAX_SLIDE_TIMING_MS } from "./timing.js";
4
5
  import { DEFAULT_TRANSITION_DURATION_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, Transition } from "./transition.js";
5
6
  import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, ImageFit, Manifest, Narration, PLAYBACK_MODES, Playback, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits, parsePlayback } from "./deck.js";
@@ -140,7 +141,8 @@ const Page = z.object({
140
141
  scripts: Scripts.default("refuse"),
141
142
  dir: Direction.optional(),
142
143
  lang: z.string().optional(),
143
- print: Print.optional()
144
+ print: Print.optional(),
145
+ slots: Slots.optional()
144
146
  });
145
147
  function jsonSchemas() {
146
148
  return {
@@ -154,8 +156,10 @@ function jsonSchemas() {
154
156
  publishedShot: z.toJSONSchema(PublishedShot, { io: "input" }),
155
157
  board: z.toJSONSchema(Board, { io: "input" }),
156
158
  printSetting: z.toJSONSchema(PrintSetting, { io: "input" }),
157
- printSettingInput: z.toJSONSchema(PrintSettingInput, { io: "input" })
159
+ printSettingInput: z.toJSONSchema(PrintSettingInput, { io: "input" }),
160
+ slotDeclaration: z.toJSONSchema(SlotDeclaration, { io: "input" }),
161
+ slotDeclarationInput: z.toJSONSchema(SlotDeclarationInput, { io: "input" })
158
162
  };
159
163
  }
160
164
  //#endregion
161
- export { Annotation, Board, BoardItem, BoardLabel, BoardSection, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, GridCell, ImageFit, Imposition, Lexicon, MAKE_ROOM_LIMIT, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ITEM_WIDTH, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PX_PER_MM, Page, PageSize, Paper, PaperUnit, Playback, Point, Print, PrintSetting, PrintSettingInput, PronunciationEntry, PublishedShot, SECTION_GAP, SECTION_MIN_SIZE, SECTION_PADDING, SECTION_TITLE_ROOM, SHOT_KEY, Scripts, Shot, Size, Slide, SlideContent, TextDirection, Transition, Word, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, foldForSearch, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, insertIntoGrid, isBookContents, isHebrew, itemAt, itemHeight, jsonSchemas, languageDirection, layoutSection, lexiconVersion, makeRoom, mirrorPlacement, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, parsePlayback, printBoxes, printPadding, printProperties, removeFromGrid, removeItems, resizeItem, resolveDirection, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
165
+ export { Annotation, Board, BoardItem, BoardLabel, BoardSection, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, GridCell, ImageFit, Imposition, Lexicon, MAKE_ROOM_LIMIT, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ITEM_WIDTH, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PX_PER_MM, Page, PageSize, Paper, PaperUnit, Playback, Point, Print, PrintSetting, PrintSettingInput, PronunciationEntry, PublishedShot, SECTION_GAP, SECTION_MIN_SIZE, SECTION_PADDING, SECTION_TITLE_ROOM, SHOT_KEY, SLOT_TYPES, Scripts, Shot, Size, Slide, SlideContent, SlotDeclaration, SlotDeclarationInput, SlotType, Slots, SlotsInput, TextDirection, Transition, Word, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, foldForSearch, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, insertIntoGrid, isBookContents, isHebrew, itemAt, itemHeight, jsonSchemas, languageDirection, layoutSection, lexiconVersion, makeRoom, mergeSlotDeclarations, mirrorPlacement, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, parsePlayback, printBoxes, printPadding, printProperties, removeFromGrid, removeItems, resizeItem, resolveDirection, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
@@ -0,0 +1,201 @@
1
+ import { z } from "zod";
2
+ //#region src/slots.d.ts
3
+ export declare const SLOT_TYPES: readonly ["text", "phone", "email", "link", "qr", "image"];
4
+ export declare const SlotType: z.ZodEnum<{
5
+ text: "text";
6
+ phone: "phone";
7
+ email: "email";
8
+ link: "link";
9
+ qr: "qr";
10
+ image: "image";
11
+ }>;
12
+ export type SlotType = z.infer<typeof SlotType>;
13
+ export declare const SlotDeclaration: z.ZodPipe<z.ZodObject<{
14
+ key: z.ZodString;
15
+ label: z.ZodString;
16
+ type: z.ZodEnum<{
17
+ text: "text";
18
+ phone: "phone";
19
+ email: "email";
20
+ link: "link";
21
+ qr: "qr";
22
+ image: "image";
23
+ }>;
24
+ required: z.ZodDefault<z.ZodBoolean>;
25
+ placeholder: z.ZodOptional<z.ZodString>;
26
+ overflow: z.ZodDefault<z.ZodEnum<{
27
+ refuse: "refuse";
28
+ shrink: "shrink";
29
+ truncate: "truncate";
30
+ wrap: "wrap";
31
+ }>>;
32
+ minSize: z.ZodOptional<z.ZodNumber>;
33
+ }, z.core.$strip>, z.ZodTransform<{
34
+ key: string;
35
+ label: string;
36
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
37
+ required: boolean;
38
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
39
+ placeholder?: string | undefined;
40
+ minSize?: number | undefined;
41
+ }, {
42
+ key: string;
43
+ label: string;
44
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
45
+ required: boolean;
46
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
47
+ placeholder?: string | undefined;
48
+ minSize?: number | undefined;
49
+ }>>;
50
+ export type SlotDeclaration = Omit<z.infer<typeof SlotDeclaration>, 'overflow'> & {
51
+ overflow?: z.infer<typeof SlotDeclaration>['overflow'];
52
+ };
53
+ export declare const SlotDeclarationInput: z.ZodPipe<z.ZodObject<{
54
+ key: z.ZodString;
55
+ label: z.ZodString;
56
+ type: z.ZodEnum<{
57
+ text: "text";
58
+ phone: "phone";
59
+ email: "email";
60
+ link: "link";
61
+ qr: "qr";
62
+ image: "image";
63
+ }>;
64
+ required: z.ZodDefault<z.ZodBoolean>;
65
+ placeholder: z.ZodOptional<z.ZodString>;
66
+ overflow: z.ZodDefault<z.ZodEnum<{
67
+ refuse: "refuse";
68
+ shrink: "shrink";
69
+ truncate: "truncate";
70
+ wrap: "wrap";
71
+ }>>;
72
+ minSize: z.ZodOptional<z.ZodNumber>;
73
+ }, z.core.$strict>, z.ZodTransform<{
74
+ key: string;
75
+ label: string;
76
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
77
+ required: boolean;
78
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
79
+ placeholder?: string | undefined;
80
+ minSize?: number | undefined;
81
+ }, {
82
+ key: string;
83
+ label: string;
84
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
85
+ required: boolean;
86
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
87
+ placeholder?: string | undefined;
88
+ minSize?: number | undefined;
89
+ }>>;
90
+ export type SlotDeclarationInput = z.input<typeof SlotDeclarationInput>;
91
+ export declare const Slots: z.ZodArray<z.ZodPipe<z.ZodObject<{
92
+ key: z.ZodString;
93
+ label: z.ZodString;
94
+ type: z.ZodEnum<{
95
+ text: "text";
96
+ phone: "phone";
97
+ email: "email";
98
+ link: "link";
99
+ qr: "qr";
100
+ image: "image";
101
+ }>;
102
+ required: z.ZodDefault<z.ZodBoolean>;
103
+ placeholder: z.ZodOptional<z.ZodString>;
104
+ overflow: z.ZodDefault<z.ZodEnum<{
105
+ refuse: "refuse";
106
+ shrink: "shrink";
107
+ truncate: "truncate";
108
+ wrap: "wrap";
109
+ }>>;
110
+ minSize: z.ZodOptional<z.ZodNumber>;
111
+ }, z.core.$strip>, z.ZodTransform<{
112
+ key: string;
113
+ label: string;
114
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
115
+ required: boolean;
116
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
117
+ placeholder?: string | undefined;
118
+ minSize?: number | undefined;
119
+ }, {
120
+ key: string;
121
+ label: string;
122
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
123
+ required: boolean;
124
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
125
+ placeholder?: string | undefined;
126
+ minSize?: number | undefined;
127
+ }>>>;
128
+ export type Slots = z.infer<typeof Slots>;
129
+ export declare const SlotsInput: z.ZodArray<z.ZodPipe<z.ZodObject<{
130
+ key: z.ZodString;
131
+ label: z.ZodString;
132
+ type: z.ZodEnum<{
133
+ text: "text";
134
+ phone: "phone";
135
+ email: "email";
136
+ link: "link";
137
+ qr: "qr";
138
+ image: "image";
139
+ }>;
140
+ required: z.ZodDefault<z.ZodBoolean>;
141
+ placeholder: z.ZodOptional<z.ZodString>;
142
+ overflow: z.ZodDefault<z.ZodEnum<{
143
+ refuse: "refuse";
144
+ shrink: "shrink";
145
+ truncate: "truncate";
146
+ wrap: "wrap";
147
+ }>>;
148
+ minSize: z.ZodOptional<z.ZodNumber>;
149
+ }, z.core.$strict>, z.ZodTransform<{
150
+ key: string;
151
+ label: string;
152
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
153
+ required: boolean;
154
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
155
+ placeholder?: string | undefined;
156
+ minSize?: number | undefined;
157
+ }, {
158
+ key: string;
159
+ label: string;
160
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
161
+ required: boolean;
162
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
163
+ placeholder?: string | undefined;
164
+ minSize?: number | undefined;
165
+ }>>>;
166
+ export type SlotsInput = z.input<typeof SlotsInput>;
167
+ export type SlotValue = string | {
168
+ asset: string;
169
+ };
170
+ export interface Fill {
171
+ id: string;
172
+ label?: string;
173
+ values: Record<string, SlotValue>;
174
+ }
175
+ export interface SlotSource {
176
+ id: string;
177
+ label: string;
178
+ fields: string[];
179
+ list(options: {
180
+ signal: AbortSignal;
181
+ }): Promise<Fill[]>;
182
+ }
183
+ export type SlotState = 'filled' | 'placeholder' | 'unavailable' | 'invalid' | 'fit' | 'shrunk' | 'overflowed';
184
+ export interface SlotReport {
185
+ fill: string | null;
186
+ slots: Record<string, SlotState>;
187
+ origins: Record<string, 'hand' | 'source'>;
188
+ }
189
+ export interface SlotsOptions {
190
+ /** The fill selected from a host data source; hand values override it per declared key. */
191
+ source?: Fill;
192
+ fill?: Fill;
193
+ declarations?: SlotDeclarationInput[];
194
+ /** Resolve an asset without network access. Hosts should honour the signal so timed-out renders stop this work promptly. */
195
+ resolveAsset?: (ref: string, options: {
196
+ signal: AbortSignal;
197
+ }) => Promise<string>;
198
+ report?: (report: SlotReport) => void;
199
+ }
200
+ export declare function mergeSlotDeclarations(...groups: ReadonlyArray<readonly SlotDeclaration[]>): SlotDeclaration[];
201
+ //#endregion
package/dist/slots.js ADDED
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ //#region src/slots.ts
3
+ const SLOT_TYPES = [
4
+ "text",
5
+ "phone",
6
+ "email",
7
+ "link",
8
+ "qr",
9
+ "image"
10
+ ];
11
+ const SlotType = z.enum(SLOT_TYPES);
12
+ const SlotDeclarationShape = {
13
+ key: z.string().regex(/^[^.\s]+(?:\.[^.\s]+)*$/, "a slot key must be a dotted path"),
14
+ label: z.string().min(1),
15
+ type: SlotType,
16
+ required: z.boolean().default(false),
17
+ placeholder: z.string().optional(),
18
+ overflow: z.enum([
19
+ "shrink",
20
+ "truncate",
21
+ "wrap",
22
+ "refuse"
23
+ ]).default("wrap"),
24
+ minSize: z.number().positive().finite().optional()
25
+ };
26
+ function validateOverflow(slot, ctx) {
27
+ if ((slot.type === "qr" || slot.type === "image") && slot.overflow !== "wrap") ctx.addIssue({
28
+ code: "custom",
29
+ path: ["overflow"],
30
+ message: `overflow cannot be declared for ${slot.type} slots`
31
+ });
32
+ if (slot.type === "qr" || slot.type === "image") {
33
+ if (slot.minSize !== void 0) ctx.addIssue({
34
+ code: "custom",
35
+ path: ["minSize"],
36
+ message: `minSize cannot be declared for ${slot.type} slots`
37
+ });
38
+ } else if (slot.overflow !== "shrink" && slot.minSize !== void 0) ctx.addIssue({
39
+ code: "custom",
40
+ path: ["minSize"],
41
+ message: "minSize can be declared only when overflow is shrink"
42
+ });
43
+ }
44
+ const withOverflowDefaults = (slot) => slot.overflow === "shrink" ? {
45
+ ...slot,
46
+ minSize: slot.minSize ?? 6
47
+ } : slot;
48
+ const SlotDeclaration = z.object(SlotDeclarationShape).superRefine(validateOverflow).transform(withOverflowDefaults);
49
+ const SlotDeclarationInput = z.strictObject(SlotDeclarationShape).superRefine(validateOverflow).transform(withOverflowDefaults);
50
+ const Slots = z.array(SlotDeclaration).superRefine((slots, ctx) => {
51
+ const seen = /* @__PURE__ */ new Set();
52
+ slots.forEach((slot, index) => {
53
+ if (seen.has(slot.key)) ctx.addIssue({
54
+ code: "custom",
55
+ path: [index, "key"],
56
+ message: `slot key "${slot.key}" is used twice`
57
+ });
58
+ seen.add(slot.key);
59
+ });
60
+ });
61
+ const SlotsInput = z.array(SlotDeclarationInput).superRefine((slots, ctx) => {
62
+ const seen = /* @__PURE__ */ new Set();
63
+ slots.forEach((slot, index) => {
64
+ if (seen.has(slot.key)) ctx.addIssue({
65
+ code: "custom",
66
+ path: [index, "key"],
67
+ message: `slot key "${slot.key}" is used twice`
68
+ });
69
+ seen.add(slot.key);
70
+ });
71
+ });
72
+ function mergeSlotDeclarations(...groups) {
73
+ const merged = /* @__PURE__ */ new Map();
74
+ for (const slot of groups.flat()) {
75
+ const previous = merged.get(slot.key);
76
+ if (!previous) {
77
+ merged.set(slot.key, slot);
78
+ continue;
79
+ }
80
+ if (previous.type !== slot.type || previous.required !== slot.required || (previous.overflow ?? "wrap") !== (slot.overflow ?? "wrap") || previous.minSize !== slot.minSize) throw new RangeError(`Slot "${slot.key}" has conflicting declarations: type ${previous.type}, required ${previous.required}, overflow ${previous.overflow ?? "wrap"}; type ${slot.type}, required ${slot.required}, overflow ${slot.overflow ?? "wrap"}.`);
81
+ }
82
+ return [...merged.values()];
83
+ }
84
+ //#endregion
85
+ export { SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotType, Slots, SlotsInput, mergeSlotDeclarations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segnavia/format",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {