@segnavia/format 0.22.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.
@@ -125,9 +125,11 @@ export declare function deckFromSlides(rows: SlideRow[], options: DeckFromSlides
125
125
  slots?: {
126
126
  key: string;
127
127
  label: string;
128
- type: "text" | "phone" | "email" | "link" | "image";
128
+ type: "text" | "phone" | "email" | "link" | "qr" | "image";
129
129
  required: boolean;
130
+ overflow: "refuse" | "shrink" | "truncate" | "wrap";
130
131
  placeholder?: string | undefined;
132
+ minSize?: number | undefined;
131
133
  }[] | undefined;
132
134
  };
133
135
  //#endregion
package/dist/deck.d.ts CHANGED
@@ -438,7 +438,7 @@ export declare const Deck: z.ZodObject<{
438
438
  off: "off";
439
439
  viewer: "viewer";
440
440
  }>>;
441
- slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
441
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
442
442
  key: z.ZodString;
443
443
  label: z.ZodString;
444
444
  type: z.ZodEnum<{
@@ -446,11 +446,35 @@ export declare const Deck: z.ZodObject<{
446
446
  phone: "phone";
447
447
  email: "email";
448
448
  link: "link";
449
+ qr: "qr";
449
450
  image: "image";
450
451
  }>;
451
452
  required: z.ZodDefault<z.ZodBoolean>;
452
453
  placeholder: z.ZodOptional<z.ZodString>;
453
- }, z.core.$strip>>>;
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
+ }>>>>;
454
478
  slides: z.ZodArray<z.ZodObject<{
455
479
  id: z.ZodString;
456
480
  content: z.ZodDiscriminatedUnion<[z.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -17,7 +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, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, mergeSlotDeclarations } from "./slots.js";
20
+ import { Fill, SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, mergeSlotDeclarations } from "./slots.js";
21
21
  import { z } from "zod";
22
22
  //#region src/index.d.ts
23
23
  export declare const Margin: z.ZodObject<{
@@ -250,7 +250,7 @@ export declare const Page: z.ZodObject<{
250
250
  safe: z.ZodDefault<z.ZodNumber>;
251
251
  marks: z.ZodDefault<z.ZodBoolean>;
252
252
  }, z.core.$strip>>;
253
- slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
253
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
254
254
  key: z.ZodString;
255
255
  label: z.ZodString;
256
256
  type: z.ZodEnum<{
@@ -258,11 +258,35 @@ export declare const Page: z.ZodObject<{
258
258
  phone: "phone";
259
259
  email: "email";
260
260
  link: "link";
261
+ qr: "qr";
261
262
  image: "image";
262
263
  }>;
263
264
  required: z.ZodDefault<z.ZodBoolean>;
264
265
  placeholder: z.ZodOptional<z.ZodString>;
265
- }, z.core.$strip>>>;
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
+ }>>>>;
266
290
  }, z.core.$strip>;
267
291
  export type Page = z.infer<typeof Page>;
268
292
  export type PageInput = z.input<typeof Page>;
@@ -476,7 +500,7 @@ export declare function jsonSchemas(): {
476
500
  safe: z.ZodDefault<z.ZodNumber>;
477
501
  marks: z.ZodDefault<z.ZodBoolean>;
478
502
  }, z.core.$strip>>;
479
- slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
503
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
480
504
  key: z.ZodString;
481
505
  label: z.ZodString;
482
506
  type: z.ZodEnum<{
@@ -484,11 +508,35 @@ export declare function jsonSchemas(): {
484
508
  phone: "phone";
485
509
  email: "email";
486
510
  link: "link";
511
+ qr: "qr";
487
512
  image: "image";
488
513
  }>;
489
514
  required: z.ZodDefault<z.ZodBoolean>;
490
515
  placeholder: z.ZodOptional<z.ZodString>;
491
- }, z.core.$strip>>>;
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
+ }>>>>;
492
540
  }, z.core.$strip>>;
493
541
  lexicon: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
494
542
  entries: z.ZodArray<z.ZodObject<{
@@ -628,7 +676,7 @@ export declare function jsonSchemas(): {
628
676
  off: "off";
629
677
  viewer: "viewer";
630
678
  }>>;
631
- slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
679
+ slots: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodObject<{
632
680
  key: z.ZodString;
633
681
  label: z.ZodString;
634
682
  type: z.ZodEnum<{
@@ -636,11 +684,35 @@ export declare function jsonSchemas(): {
636
684
  phone: "phone";
637
685
  email: "email";
638
686
  link: "link";
687
+ qr: "qr";
639
688
  image: "image";
640
689
  }>;
641
690
  required: z.ZodDefault<z.ZodBoolean>;
642
691
  placeholder: z.ZodOptional<z.ZodString>;
643
- }, z.core.$strip>>>;
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
+ }>>>>;
644
716
  slides: z.ZodArray<z.ZodObject<{
645
717
  id: z.ZodString;
646
718
  content: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -986,7 +1058,7 @@ export declare function jsonSchemas(): {
986
1058
  landscape: "landscape";
987
1059
  }>;
988
1060
  }, z.core.$strict>>;
989
- slotDeclaration: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
1061
+ slotDeclaration: z.core.ZodStandardJSONSchemaPayload<z.ZodPipe<z.ZodObject<{
990
1062
  key: z.ZodString;
991
1063
  label: z.ZodString;
992
1064
  type: z.ZodEnum<{
@@ -994,12 +1066,36 @@ export declare function jsonSchemas(): {
994
1066
  phone: "phone";
995
1067
  email: "email";
996
1068
  link: "link";
1069
+ qr: "qr";
997
1070
  image: "image";
998
1071
  }>;
999
1072
  required: z.ZodDefault<z.ZodBoolean>;
1000
1073
  placeholder: z.ZodOptional<z.ZodString>;
1001
- }, z.core.$strip>>;
1002
- slotDeclarationInput: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
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<{
1003
1099
  key: z.ZodString;
1004
1100
  label: z.ZodString;
1005
1101
  type: z.ZodEnum<{
@@ -1007,11 +1103,35 @@ export declare function jsonSchemas(): {
1007
1103
  phone: "phone";
1008
1104
  email: "email";
1009
1105
  link: "link";
1106
+ qr: "qr";
1010
1107
  image: "image";
1011
1108
  }>;
1012
1109
  required: z.ZodDefault<z.ZodBoolean>;
1013
1110
  placeholder: z.ZodOptional<z.ZodString>;
1014
- }, z.core.$strict>>;
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
+ }>>>;
1015
1135
  };
1016
1136
  //#endregion
1017
- 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, 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 };
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/slots.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  import { z } from "zod";
2
2
  //#region src/slots.d.ts
3
- export declare const SLOT_TYPES: readonly ["text", "phone", "email", "link", "image"];
3
+ export declare const SLOT_TYPES: readonly ["text", "phone", "email", "link", "qr", "image"];
4
4
  export declare const SlotType: z.ZodEnum<{
5
5
  text: "text";
6
6
  phone: "phone";
7
7
  email: "email";
8
8
  link: "link";
9
+ qr: "qr";
9
10
  image: "image";
10
11
  }>;
11
12
  export type SlotType = z.infer<typeof SlotType>;
12
- export declare const SlotDeclaration: z.ZodObject<{
13
+ export declare const SlotDeclaration: z.ZodPipe<z.ZodObject<{
13
14
  key: z.ZodString;
14
15
  label: z.ZodString;
15
16
  type: z.ZodEnum<{
@@ -17,13 +18,39 @@ export declare const SlotDeclaration: z.ZodObject<{
17
18
  phone: "phone";
18
19
  email: "email";
19
20
  link: "link";
21
+ qr: "qr";
20
22
  image: "image";
21
23
  }>;
22
24
  required: z.ZodDefault<z.ZodBoolean>;
23
25
  placeholder: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>;
25
- export type SlotDeclaration = z.infer<typeof SlotDeclaration>;
26
- export declare const SlotDeclarationInput: z.ZodObject<{
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<{
27
54
  key: z.ZodString;
28
55
  label: z.ZodString;
29
56
  type: z.ZodEnum<{
@@ -31,13 +58,37 @@ export declare const SlotDeclarationInput: z.ZodObject<{
31
58
  phone: "phone";
32
59
  email: "email";
33
60
  link: "link";
61
+ qr: "qr";
34
62
  image: "image";
35
63
  }>;
36
64
  required: z.ZodDefault<z.ZodBoolean>;
37
65
  placeholder: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strict>;
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
+ }>>;
39
90
  export type SlotDeclarationInput = z.input<typeof SlotDeclarationInput>;
40
- export declare const Slots: z.ZodArray<z.ZodObject<{
91
+ export declare const Slots: z.ZodArray<z.ZodPipe<z.ZodObject<{
41
92
  key: z.ZodString;
42
93
  label: z.ZodString;
43
94
  type: z.ZodEnum<{
@@ -45,13 +96,37 @@ export declare const Slots: z.ZodArray<z.ZodObject<{
45
96
  phone: "phone";
46
97
  email: "email";
47
98
  link: "link";
99
+ qr: "qr";
48
100
  image: "image";
49
101
  }>;
50
102
  required: z.ZodDefault<z.ZodBoolean>;
51
103
  placeholder: z.ZodOptional<z.ZodString>;
52
- }, z.core.$strip>>;
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
+ }>>>;
53
128
  export type Slots = z.infer<typeof Slots>;
54
- export declare const SlotsInput: z.ZodArray<z.ZodObject<{
129
+ export declare const SlotsInput: z.ZodArray<z.ZodPipe<z.ZodObject<{
55
130
  key: z.ZodString;
56
131
  label: z.ZodString;
57
132
  type: z.ZodEnum<{
@@ -59,11 +134,35 @@ export declare const SlotsInput: z.ZodArray<z.ZodObject<{
59
134
  phone: "phone";
60
135
  email: "email";
61
136
  link: "link";
137
+ qr: "qr";
62
138
  image: "image";
63
139
  }>;
64
140
  required: z.ZodDefault<z.ZodBoolean>;
65
141
  placeholder: z.ZodOptional<z.ZodString>;
66
- }, z.core.$strict>>;
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
+ }>>>;
67
166
  export type SlotsInput = z.input<typeof SlotsInput>;
68
167
  export type SlotValue = string | {
69
168
  asset: string;
@@ -73,12 +172,23 @@ export interface Fill {
73
172
  label?: string;
74
173
  values: Record<string, SlotValue>;
75
174
  }
76
- export type SlotState = 'filled' | 'placeholder' | 'unavailable' | 'invalid';
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';
77
184
  export interface SlotReport {
78
185
  fill: string | null;
79
186
  slots: Record<string, SlotState>;
187
+ origins: Record<string, 'hand' | 'source'>;
80
188
  }
81
189
  export interface SlotsOptions {
190
+ /** The fill selected from a host data source; hand values override it per declared key. */
191
+ source?: Fill;
82
192
  fill?: Fill;
83
193
  declarations?: SlotDeclarationInput[];
84
194
  /** Resolve an asset without network access. Hosts should honour the signal so timed-out renders stop this work promptly. */
package/dist/slots.js CHANGED
@@ -5,6 +5,7 @@ const SLOT_TYPES = [
5
5
  "phone",
6
6
  "email",
7
7
  "link",
8
+ "qr",
8
9
  "image"
9
10
  ];
10
11
  const SlotType = z.enum(SLOT_TYPES);
@@ -13,10 +14,39 @@ const SlotDeclarationShape = {
13
14
  label: z.string().min(1),
14
15
  type: SlotType,
15
16
  required: z.boolean().default(false),
16
- placeholder: z.string().optional()
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()
17
25
  };
18
- const SlotDeclaration = z.object(SlotDeclarationShape);
19
- const SlotDeclarationInput = z.strictObject(SlotDeclarationShape);
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);
20
50
  const Slots = z.array(SlotDeclaration).superRefine((slots, ctx) => {
21
51
  const seen = /* @__PURE__ */ new Set();
22
52
  slots.forEach((slot, index) => {
@@ -47,7 +77,7 @@ function mergeSlotDeclarations(...groups) {
47
77
  merged.set(slot.key, slot);
48
78
  continue;
49
79
  }
50
- if (previous.type !== slot.type || previous.required !== slot.required) throw new RangeError(`Slot "${slot.key}" has conflicting declarations: type ${previous.type}, required ${previous.required}; type ${slot.type}, required ${slot.required}.`);
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"}.`);
51
81
  }
52
82
  return [...merged.values()];
53
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segnavia/format",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {