@segnavia/format 0.21.0 → 0.22.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 +2 -2
- package/dist/deck-from-slides.d.ts +7 -0
- package/dist/deck.d.ts +13 -0
- package/dist/deck.js +2 -0
- package/dist/index.d.ts +68 -2
- package/dist/index.js +7 -3
- package/dist/slots.d.ts +91 -0
- package/dist/slots.js +55 -0
- package/package.json +1 -1
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,12 @@ 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" | "image";
|
|
129
|
+
required: boolean;
|
|
130
|
+
placeholder?: string | undefined;
|
|
131
|
+
}[] | undefined;
|
|
125
132
|
};
|
|
126
133
|
//#endregion
|
package/dist/deck.d.ts
CHANGED
|
@@ -438,6 +438,19 @@ export declare const Deck: z.ZodObject<{
|
|
|
438
438
|
off: "off";
|
|
439
439
|
viewer: "viewer";
|
|
440
440
|
}>>;
|
|
441
|
+
slots: z.ZodOptional<z.ZodArray<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
|
+
image: "image";
|
|
450
|
+
}>;
|
|
451
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
452
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
453
|
+
}, z.core.$strip>>>;
|
|
441
454
|
slides: z.ZodArray<z.ZodObject<{
|
|
442
455
|
id: z.ZodString;
|
|
443
456
|
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, 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,19 @@ 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.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
|
+
image: "image";
|
|
262
|
+
}>;
|
|
263
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
264
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>>>;
|
|
252
266
|
}, z.core.$strip>;
|
|
253
267
|
export type Page = z.infer<typeof Page>;
|
|
254
268
|
export type PageInput = z.input<typeof Page>;
|
|
@@ -462,6 +476,19 @@ export declare function jsonSchemas(): {
|
|
|
462
476
|
safe: z.ZodDefault<z.ZodNumber>;
|
|
463
477
|
marks: z.ZodDefault<z.ZodBoolean>;
|
|
464
478
|
}, z.core.$strip>>;
|
|
479
|
+
slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
480
|
+
key: z.ZodString;
|
|
481
|
+
label: z.ZodString;
|
|
482
|
+
type: z.ZodEnum<{
|
|
483
|
+
text: "text";
|
|
484
|
+
phone: "phone";
|
|
485
|
+
email: "email";
|
|
486
|
+
link: "link";
|
|
487
|
+
image: "image";
|
|
488
|
+
}>;
|
|
489
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
490
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
491
|
+
}, z.core.$strip>>>;
|
|
465
492
|
}, z.core.$strip>>;
|
|
466
493
|
lexicon: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
467
494
|
entries: z.ZodArray<z.ZodObject<{
|
|
@@ -601,6 +628,19 @@ export declare function jsonSchemas(): {
|
|
|
601
628
|
off: "off";
|
|
602
629
|
viewer: "viewer";
|
|
603
630
|
}>>;
|
|
631
|
+
slots: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
632
|
+
key: z.ZodString;
|
|
633
|
+
label: z.ZodString;
|
|
634
|
+
type: z.ZodEnum<{
|
|
635
|
+
text: "text";
|
|
636
|
+
phone: "phone";
|
|
637
|
+
email: "email";
|
|
638
|
+
link: "link";
|
|
639
|
+
image: "image";
|
|
640
|
+
}>;
|
|
641
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
642
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
643
|
+
}, z.core.$strip>>>;
|
|
604
644
|
slides: z.ZodArray<z.ZodObject<{
|
|
605
645
|
id: z.ZodString;
|
|
606
646
|
content: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -822,10 +862,10 @@ export declare function jsonSchemas(): {
|
|
|
822
862
|
id: z.ZodString;
|
|
823
863
|
kind: z.ZodEnum<{
|
|
824
864
|
paper: "paper";
|
|
865
|
+
image: "image";
|
|
825
866
|
page: "page";
|
|
826
867
|
book: "book";
|
|
827
868
|
shot: "shot";
|
|
828
|
-
image: "image";
|
|
829
869
|
deck: "deck";
|
|
830
870
|
}>;
|
|
831
871
|
address: z.ZodString;
|
|
@@ -946,6 +986,32 @@ export declare function jsonSchemas(): {
|
|
|
946
986
|
landscape: "landscape";
|
|
947
987
|
}>;
|
|
948
988
|
}, z.core.$strict>>;
|
|
989
|
+
slotDeclaration: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
990
|
+
key: z.ZodString;
|
|
991
|
+
label: z.ZodString;
|
|
992
|
+
type: z.ZodEnum<{
|
|
993
|
+
text: "text";
|
|
994
|
+
phone: "phone";
|
|
995
|
+
email: "email";
|
|
996
|
+
link: "link";
|
|
997
|
+
image: "image";
|
|
998
|
+
}>;
|
|
999
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
1000
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
1001
|
+
}, z.core.$strip>>;
|
|
1002
|
+
slotDeclarationInput: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
|
1003
|
+
key: z.ZodString;
|
|
1004
|
+
label: z.ZodString;
|
|
1005
|
+
type: z.ZodEnum<{
|
|
1006
|
+
text: "text";
|
|
1007
|
+
phone: "phone";
|
|
1008
|
+
email: "email";
|
|
1009
|
+
link: "link";
|
|
1010
|
+
image: "image";
|
|
1011
|
+
}>;
|
|
1012
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
1013
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
1014
|
+
}, z.core.$strict>>;
|
|
949
1015
|
};
|
|
950
1016
|
//#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 };
|
|
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 };
|
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 };
|
package/dist/slots.d.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/slots.d.ts
|
|
3
|
+
export declare const SLOT_TYPES: readonly ["text", "phone", "email", "link", "image"];
|
|
4
|
+
export declare const SlotType: z.ZodEnum<{
|
|
5
|
+
text: "text";
|
|
6
|
+
phone: "phone";
|
|
7
|
+
email: "email";
|
|
8
|
+
link: "link";
|
|
9
|
+
image: "image";
|
|
10
|
+
}>;
|
|
11
|
+
export type SlotType = z.infer<typeof SlotType>;
|
|
12
|
+
export declare const SlotDeclaration: z.ZodObject<{
|
|
13
|
+
key: z.ZodString;
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
text: "text";
|
|
17
|
+
phone: "phone";
|
|
18
|
+
email: "email";
|
|
19
|
+
link: "link";
|
|
20
|
+
image: "image";
|
|
21
|
+
}>;
|
|
22
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
23
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type SlotDeclaration = z.infer<typeof SlotDeclaration>;
|
|
26
|
+
export declare const SlotDeclarationInput: z.ZodObject<{
|
|
27
|
+
key: z.ZodString;
|
|
28
|
+
label: z.ZodString;
|
|
29
|
+
type: z.ZodEnum<{
|
|
30
|
+
text: "text";
|
|
31
|
+
phone: "phone";
|
|
32
|
+
email: "email";
|
|
33
|
+
link: "link";
|
|
34
|
+
image: "image";
|
|
35
|
+
}>;
|
|
36
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type SlotDeclarationInput = z.input<typeof SlotDeclarationInput>;
|
|
40
|
+
export declare const Slots: z.ZodArray<z.ZodObject<{
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
label: z.ZodString;
|
|
43
|
+
type: z.ZodEnum<{
|
|
44
|
+
text: "text";
|
|
45
|
+
phone: "phone";
|
|
46
|
+
email: "email";
|
|
47
|
+
link: "link";
|
|
48
|
+
image: "image";
|
|
49
|
+
}>;
|
|
50
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
export type Slots = z.infer<typeof Slots>;
|
|
54
|
+
export declare const SlotsInput: z.ZodArray<z.ZodObject<{
|
|
55
|
+
key: z.ZodString;
|
|
56
|
+
label: z.ZodString;
|
|
57
|
+
type: z.ZodEnum<{
|
|
58
|
+
text: "text";
|
|
59
|
+
phone: "phone";
|
|
60
|
+
email: "email";
|
|
61
|
+
link: "link";
|
|
62
|
+
image: "image";
|
|
63
|
+
}>;
|
|
64
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
export type SlotsInput = z.input<typeof SlotsInput>;
|
|
68
|
+
export type SlotValue = string | {
|
|
69
|
+
asset: string;
|
|
70
|
+
};
|
|
71
|
+
export interface Fill {
|
|
72
|
+
id: string;
|
|
73
|
+
label?: string;
|
|
74
|
+
values: Record<string, SlotValue>;
|
|
75
|
+
}
|
|
76
|
+
export type SlotState = 'filled' | 'placeholder' | 'unavailable' | 'invalid';
|
|
77
|
+
export interface SlotReport {
|
|
78
|
+
fill: string | null;
|
|
79
|
+
slots: Record<string, SlotState>;
|
|
80
|
+
}
|
|
81
|
+
export interface SlotsOptions {
|
|
82
|
+
fill?: Fill;
|
|
83
|
+
declarations?: SlotDeclarationInput[];
|
|
84
|
+
/** Resolve an asset without network access. Hosts should honour the signal so timed-out renders stop this work promptly. */
|
|
85
|
+
resolveAsset?: (ref: string, options: {
|
|
86
|
+
signal: AbortSignal;
|
|
87
|
+
}) => Promise<string>;
|
|
88
|
+
report?: (report: SlotReport) => void;
|
|
89
|
+
}
|
|
90
|
+
export declare function mergeSlotDeclarations(...groups: ReadonlyArray<readonly SlotDeclaration[]>): SlotDeclaration[];
|
|
91
|
+
//#endregion
|
package/dist/slots.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/slots.ts
|
|
3
|
+
const SLOT_TYPES = [
|
|
4
|
+
"text",
|
|
5
|
+
"phone",
|
|
6
|
+
"email",
|
|
7
|
+
"link",
|
|
8
|
+
"image"
|
|
9
|
+
];
|
|
10
|
+
const SlotType = z.enum(SLOT_TYPES);
|
|
11
|
+
const SlotDeclarationShape = {
|
|
12
|
+
key: z.string().regex(/^[^.\s]+(?:\.[^.\s]+)*$/, "a slot key must be a dotted path"),
|
|
13
|
+
label: z.string().min(1),
|
|
14
|
+
type: SlotType,
|
|
15
|
+
required: z.boolean().default(false),
|
|
16
|
+
placeholder: z.string().optional()
|
|
17
|
+
};
|
|
18
|
+
const SlotDeclaration = z.object(SlotDeclarationShape);
|
|
19
|
+
const SlotDeclarationInput = z.strictObject(SlotDeclarationShape);
|
|
20
|
+
const Slots = z.array(SlotDeclaration).superRefine((slots, ctx) => {
|
|
21
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22
|
+
slots.forEach((slot, index) => {
|
|
23
|
+
if (seen.has(slot.key)) ctx.addIssue({
|
|
24
|
+
code: "custom",
|
|
25
|
+
path: [index, "key"],
|
|
26
|
+
message: `slot key "${slot.key}" is used twice`
|
|
27
|
+
});
|
|
28
|
+
seen.add(slot.key);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
const SlotsInput = z.array(SlotDeclarationInput).superRefine((slots, ctx) => {
|
|
32
|
+
const seen = /* @__PURE__ */ new Set();
|
|
33
|
+
slots.forEach((slot, index) => {
|
|
34
|
+
if (seen.has(slot.key)) ctx.addIssue({
|
|
35
|
+
code: "custom",
|
|
36
|
+
path: [index, "key"],
|
|
37
|
+
message: `slot key "${slot.key}" is used twice`
|
|
38
|
+
});
|
|
39
|
+
seen.add(slot.key);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
function mergeSlotDeclarations(...groups) {
|
|
43
|
+
const merged = /* @__PURE__ */ new Map();
|
|
44
|
+
for (const slot of groups.flat()) {
|
|
45
|
+
const previous = merged.get(slot.key);
|
|
46
|
+
if (!previous) {
|
|
47
|
+
merged.set(slot.key, slot);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
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}.`);
|
|
51
|
+
}
|
|
52
|
+
return [...merged.values()];
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotType, Slots, SlotsInput, mergeSlotDeclarations };
|