@segnavia/format 0.36.0 → 0.38.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/book.js CHANGED
@@ -3,8 +3,9 @@ import { Scripts } from "./scripts.js";
3
3
  import { Slots } from "./slots.js";
4
4
  import { FontReference } from "./fonts.js";
5
5
  import { NoteMarker, NumberSystem, isHebrew } from "./numbering.js";
6
- import { ParentPage, bookParentPages } from "./printed-pages.js";
7
- import { BookChapterEntry, BookContents, BookFrontMatterEntry, BookOpens, BookSection, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, REGION_NAME, TemplatedPage, TemplatedSection, bookParentIssues, isBookContents, isChapter, isDesignedSection, isTemplatedSection } from "./book-section.js";
6
+ import { ParentPage, bookParentPages, flowingParentNames, resolveParentPages, textArea } from "./printed-pages.js";
7
+ import { BookChapterEntry, BookContents, BookFrontMatterEntry, BookItem, BookOpens, BookSection, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, MAX_PART_DEPTH, Part, REGION_NAME, TemplatedPage, TemplatedSection, bookParentIssues, bookSections, isBookContents, isChapter, isDesignedSection, isPart, isTemplatedSection } from "./book-section.js";
8
+ import { NoteSeries, noteSeriesIssues, resolveNoteSeries } from "./note-series.js";
8
9
  import { Orientation, Paper, sheetMm } from "./paper.js";
9
10
  import { z } from "zod";
10
11
  //#region src/book.ts
@@ -20,23 +21,31 @@ const BookPage = z.object({
20
21
  }),
21
22
  columnGap: z.number().nonnegative().default(4)
22
23
  });
23
- const BookRunningHeadSource = z.union([z.literal("title"), z.object({
24
- mark: z.string().min(1),
25
- which: z.enum(["first", "last"])
26
- })]);
24
+ const BookRunningHeadSource = z.union([
25
+ z.literal("title"),
26
+ z.object({
27
+ mark: z.string().min(1),
28
+ which: z.enum(["first", "last"])
29
+ }),
30
+ z.object({ part: z.string().regex(REGION_NAME) })
31
+ ]);
27
32
  const BookRunningHead = z.object({
28
33
  recto: BookRunningHeadSource.default("title"),
29
34
  verso: BookRunningHeadSource.default("title")
30
35
  });
31
36
  const BookShape = z.object({
32
37
  title: z.string(),
38
+ authors: z.array(z.string()).optional(),
39
+ subject: z.string().optional(),
33
40
  mode: BookMode,
34
41
  page: BookPage.optional(),
35
42
  scripts: Scripts.default("refuse"),
36
43
  dir: Direction.optional(),
37
44
  lang: z.string().optional(),
38
- frontMatter: z.array(BookFrontMatterEntry).default([]),
39
- chapters: z.array(BookChapterEntry).min(1),
45
+ frontMatter: z.array(BookItem).default([]),
46
+ body: z.array(BookItem).optional(),
47
+ endMatter: z.array(BookItem).default([]),
48
+ chapters: z.array(BookChapterEntry).optional(),
40
49
  parentPages: z.array(ParentPage).default([]),
41
50
  templates: z.array(BookTemplate).default([]),
42
51
  slots: Slots.optional(),
@@ -55,6 +64,7 @@ const BookShape = z.object({
55
64
  placement: z.enum(["book", "chapter"]).default("book"),
56
65
  title: z.string().optional()
57
66
  }).default({ placement: "book" }),
67
+ notes: z.array(NoteSeries).default([]),
58
68
  rectoOpenings: z.boolean().default(false),
59
69
  orphans: z.number().int().min(1).default(2),
60
70
  widows: z.number().int().min(1).default(2),
@@ -103,33 +113,126 @@ const BookView = BookShape.pick({
103
113
  }).extend({
104
114
  title: BookShape.shape.title.optional(),
105
115
  html: z.string(),
116
+ flow: z.string().optional(),
106
117
  pagination: BookViewPagination.optional()
107
118
  });
108
- const Book = BookShape.transform((book) => {
119
+ const ResolvedBook = BookShape.superRefine((book, ctx) => {
120
+ const seen = /* @__PURE__ */ new Set();
121
+ book.notes.forEach(({ name }, index) => {
122
+ if (seen.has(name)) ctx.addIssue({
123
+ code: "custom",
124
+ path: [
125
+ "notes",
126
+ index,
127
+ "name"
128
+ ],
129
+ message: `note series ${name} is duplicated; give every series a unique name`
130
+ });
131
+ seen.add(name);
132
+ if (name !== "footnote" && name !== "endnote") {
133
+ if (book.notes[index]?.placement === void 0) ctx.addIssue({
134
+ code: "custom",
135
+ path: [
136
+ "notes",
137
+ index,
138
+ "placement"
139
+ ],
140
+ message: `note series ${name} needs placement`
141
+ });
142
+ if (book.notes[index]?.numbering === void 0) ctx.addIssue({
143
+ code: "custom",
144
+ path: [
145
+ "notes",
146
+ index,
147
+ "numbering"
148
+ ],
149
+ message: `note series ${name} needs numbering`
150
+ });
151
+ }
152
+ });
153
+ }).transform((book, ctx) => {
109
154
  const hebrew = isHebrew(book.lang);
155
+ const { chapters, ...fields } = book;
156
+ if (book.body !== void 0 && chapters !== void 0) {
157
+ ctx.addIssue({
158
+ code: "custom",
159
+ path: ["body"],
160
+ message: "body and chapters were both given; keep body and remove chapters"
161
+ });
162
+ ctx.addIssue({
163
+ code: "custom",
164
+ path: ["chapters"],
165
+ message: "chapters and body were both given; keep body and remove chapters"
166
+ });
167
+ }
168
+ const notes = resolveNoteSeries({
169
+ lang: book.lang,
170
+ footnotes: book.footnotes,
171
+ endnotes: book.endnotes,
172
+ notes: book.notes
173
+ });
174
+ const footnote = notes[0];
175
+ const endnote = notes[1];
176
+ if (!footnote || !endnote) throw new Error("note series resolution did not produce the two default series");
110
177
  return {
111
- ...book,
178
+ ...fields,
179
+ body: book.body ?? chapters ?? [],
180
+ bodyKey: book.body === void 0 && chapters !== void 0 ? "chapters" : "body",
112
181
  numbering: {
113
182
  frontMatter: book.numbering.frontMatter ?? (hebrew ? "arabic" : "roman-lower"),
114
183
  body: book.numbering.body ?? (hebrew ? "hebrew" : "arabic")
115
184
  },
116
185
  footnotes: {
117
186
  ...book.footnotes,
118
- marker: book.footnotes.marker ?? (hebrew ? "hebrew" : "symbols")
187
+ marker: footnote.marker
119
188
  },
120
189
  endnotes: {
121
190
  ...book.endnotes,
122
- marker: book.endnotes.marker ?? "arabic",
123
- title: book.endnotes.title ?? (hebrew ? "הערות" : "Notes")
124
- }
191
+ marker: endnote.marker,
192
+ title: endnote.title
193
+ },
194
+ notes
125
195
  };
126
- }).superRefine((book, ctx) => {
127
- const contentsPositions = book.frontMatter.flatMap((entry, index) => isBookContents(entry) ? [index + 1] : []);
128
- if (contentsPositions.length > 1) ctx.addIssue({
129
- code: "custom",
196
+ });
197
+ function partSectionIssues(items, path) {
198
+ return items.flatMap((entry, index) => {
199
+ if (!isPart(entry)) return [];
200
+ const partPath = [...path, index];
201
+ return [...!(entry.html !== void 0 || bookSections({
202
+ frontMatter: [],
203
+ body: entry.children,
204
+ endMatter: []
205
+ }).some(({ entry: child }) => !isPart(child) || child.html !== void 0)) ? [{
206
+ path: partPath,
207
+ message: `part ${partPath.join(".")} has no section; add html or a section inside it to clear this refusal`
208
+ }] : [], ...partSectionIssues(entry.children, [...partPath, "children"])];
209
+ });
210
+ }
211
+ function structuralBookIssues(book) {
212
+ const issues = [];
213
+ if (book.body.length === 0) issues.push({
214
+ path: ["body"],
215
+ message: "a book needs at least one body entry; add a chapter or part"
216
+ });
217
+ issues.push(...partSectionIssues(book.frontMatter, ["frontMatter"]), ...partSectionIssues(book.body, [book.bodyKey]), ...partSectionIssues(book.endMatter, ["endMatter"]));
218
+ const sections = bookSections(book);
219
+ for (const section of sections) if (isBookContents(section.entry) && section.division !== "front") issues.push({
220
+ path: section.path,
221
+ message: `contents belongs in frontMatter; move this ${section.division} contents entry there`
222
+ });
223
+ const paths = sections.flatMap(({ entry, division, path }) => division === "front" && isBookContents(entry) ? [path.join(".")] : []);
224
+ if (paths.length > 1) issues.push({
130
225
  path: ["frontMatter"],
131
- message: `front-matter entries at positions ${contentsPositions[0]} and ${contentsPositions[1]} are both contents entries; one must go`
226
+ message: `front-matter entries at ${paths[0]} and ${paths[1]} are both contents entries; one must go`
227
+ });
228
+ return issues;
229
+ }
230
+ const RefinedBook = ResolvedBook.superRefine((book, ctx) => {
231
+ for (const issue of structuralBookIssues(book)) ctx.addIssue({
232
+ code: "custom",
233
+ ...issue
132
234
  });
235
+ const sections = bookSections(book);
133
236
  if (book.mode === "paginated" && !book.page) ctx.addIssue({
134
237
  code: "custom",
135
238
  path: ["page"],
@@ -140,10 +243,9 @@ const Book = BookShape.transform((book) => {
140
243
  path: ["numbering"],
141
244
  message: `front-matter and body numbering are both ${book.numbering.body}; the two must differ when front matter is present`
142
245
  });
143
- if (book.endnotes.placement === "chapter" && book.mode === "continuous") ctx.addIssue({
246
+ for (const issue of noteSeriesIssues(book.notes, book.mode)) ctx.addIssue({
144
247
  code: "custom",
145
- path: ["endnotes", "placement"],
146
- message: "endnotes are placed at the end of each chapter only in paginated mode; use book placement or paginated mode"
248
+ ...issue
147
249
  });
148
250
  for (const issue of bookParentIssues(book)) ctx.addIssue({
149
251
  code: "custom",
@@ -151,19 +253,105 @@ const Book = BookShape.transform((book) => {
151
253
  });
152
254
  if (!book.page) return;
153
255
  const trim = sheetMm(book.page);
154
- const vertical = book.page.margin.top + book.page.margin.bottom;
155
- const horizontal = book.page.margin.inner + book.page.margin.outer;
156
- if (vertical >= trim.height) ctx.addIssue({
157
- code: "custom",
158
- path: ["page", "margin"],
159
- message: `the top and bottom margins total ${vertical}mm and the page is ${trim.height}mm high; reduce the vertical margins to leave a text area`
256
+ const parents = resolveParentPages([...bookParentPages(book.page.margin), ...book.parentPages]);
257
+ const defaults = new Set(bookParentPages(book.page.margin).map((parent) => parent.name));
258
+ for (const parent of parents) {
259
+ const area = textArea(parent, trim);
260
+ const path = defaults.has(parent.name) ? ["page", "margin"] : ["parentPages"];
261
+ if (area.height <= 0) {
262
+ const total = parent.margin.top + parent.margin.bottom;
263
+ ctx.addIssue({
264
+ code: "custom",
265
+ path,
266
+ message: `parent page "${parent.name}" has top and bottom margins totaling ${total}mm on paper ${trim.height}mm high; reduce the vertical margins to leave a text area`
267
+ });
268
+ }
269
+ if (area.width <= 0) {
270
+ const total = parent.margin.inner + parent.margin.outer;
271
+ ctx.addIssue({
272
+ code: "custom",
273
+ path,
274
+ message: `parent page "${parent.name}" has inner and outer margins totaling ${total}mm on paper ${trim.width}mm wide; reduce the horizontal margins to leave a text area`
275
+ });
276
+ }
277
+ }
278
+ const byName = new Map(parents.map((parent) => [parent.name, parent]));
279
+ sections.filter(({ entry }) => !isDesignedSection(entry) && !isTemplatedSection(entry)).forEach(({ entry: flow, path }, index) => {
280
+ const names = flowingParentNames(flow.parents);
281
+ const widths = Object.entries(names).flatMap(([role, name]) => {
282
+ const parent = byName.get(name);
283
+ return parent ? [{
284
+ role,
285
+ name,
286
+ width: textArea(parent, trim).width
287
+ }] : [];
288
+ });
289
+ const first = widths[0];
290
+ const different = widths.find((candidate) => candidate.width !== first?.width);
291
+ if (!first || !different) return;
292
+ const label = flow.title ?? `flow ${index + 1}`;
293
+ ctx.addIssue({
294
+ code: "custom",
295
+ path,
296
+ message: `the ${label} flow uses parent pages "${first.name}" (${first.width}mm) and "${different.name}" (${different.width}mm) with different text widths; make the widths equal or split the flow into sections to clear this refusal`
297
+ });
160
298
  });
161
- if (horizontal >= trim.width) ctx.addIssue({
299
+ });
300
+ function partDepthIssues(value) {
301
+ if (typeof value !== "object" || value === null) return [];
302
+ const input = value;
303
+ const roots = [
304
+ ["frontMatter", input.frontMatter],
305
+ ["body", input.body],
306
+ ["chapters", input.chapters],
307
+ ["endMatter", input.endMatter]
308
+ ];
309
+ const stack = [];
310
+ for (const [key, entries] of roots) {
311
+ if (!Array.isArray(entries)) continue;
312
+ entries.forEach((entry, index) => {
313
+ stack.push({
314
+ value: entry,
315
+ path: [key, index],
316
+ depth: 0
317
+ });
318
+ });
319
+ }
320
+ const issues = [];
321
+ while (stack.length > 0) {
322
+ const current = stack.pop();
323
+ if (!current || typeof current.value !== "object" || current.value === null || !("name" in current.value)) continue;
324
+ const depth = current.depth + 1;
325
+ if (depth > 6) {
326
+ issues.push({
327
+ path: current.path,
328
+ message: `part ${current.path.join(".")} exceeds the maximum part depth of 6; reduce the nesting to clear this refusal`
329
+ });
330
+ continue;
331
+ }
332
+ const children = current.value.children;
333
+ if (!Array.isArray(children)) continue;
334
+ children.forEach((child, index) => {
335
+ stack.push({
336
+ value: child,
337
+ path: [
338
+ ...current.path,
339
+ "children",
340
+ index
341
+ ],
342
+ depth
343
+ });
344
+ });
345
+ }
346
+ return issues;
347
+ }
348
+ const Book = z.preprocess((value, ctx) => {
349
+ for (const issue of partDepthIssues(value)) ctx.addIssue({
162
350
  code: "custom",
163
- path: ["page", "margin"],
164
- message: `the inner and outer margins total ${horizontal}mm and the page is ${trim.width}mm wide; reduce the horizontal margins to leave a text area`
351
+ ...issue
165
352
  });
166
- });
353
+ return value;
354
+ }, RefinedBook).transform(({ bodyKey: _bodyKey, ...book }) => book);
167
355
  function resolveBookPagination(book) {
168
356
  if (book.mode !== "paginated" || !book.page) return void 0;
169
357
  return {
@@ -181,9 +369,5 @@ function resolveBookPagination(book) {
181
369
  runningHead: book.runningHead
182
370
  };
183
371
  }
184
- function noteMarkerIssues(book, used) {
185
- if (!used.footnotes || !used.endnotes || book.footnotes.marker !== book.endnotes.marker) return [];
186
- return [`footnote and endnote markers are both ${book.footnotes.marker}; the two must differ when both kinds are used`];
187
- }
188
372
  //#endregion
189
- export { Book, BookChapterEntry, BookContents, BookFrontMatterEntry, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, BookSectionParents, BookShape, BookTemplate, BookView, BookViewPagination, Chapter, DesignedPage, DesignedSection, REGION_NAME, TemplatedPage, TemplatedSection, isBookContents, isChapter, isDesignedSection, isTemplatedSection, noteMarkerIssues, resolveBookPagination };
373
+ export { Book, BookChapterEntry, BookContents, BookFrontMatterEntry, BookItem, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, BookSectionParents, BookShape, BookTemplate, BookView, BookViewPagination, Chapter, DesignedPage, DesignedSection, MAX_PART_DEPTH, Part, REGION_NAME, TemplatedPage, TemplatedSection, bookSections, isBookContents, isChapter, isDesignedSection, isPart, isTemplatedSection, resolveBookPagination };
@@ -0,0 +1,12 @@
1
+ //#region src/dependency-policy.d.ts
2
+ export type DependencyDecision = {
3
+ allowed: true;
4
+ origin: string;
5
+ } | {
6
+ allowed: false;
7
+ reason: string;
8
+ };
9
+ export declare function originSet(values: Iterable<string> | undefined, bare?: boolean): Set<string>;
10
+ export declare const dependencyOriginSet: (values: Iterable<string> | undefined) => Set<string>;
11
+ export declare function dependencyDecision(value: string, approved: ReadonlySet<string>): DependencyDecision;
12
+ //#endregion
@@ -0,0 +1,42 @@
1
+ //#region src/dependency-policy.ts
2
+ const PACKAGE_PATHS = {
3
+ "https://cdn.jsdelivr.net": /^\/npm\/(?:@[^/]+\/)?[^/@]+@(\d+\.\d+\.\d+)(?:\/|$)/,
4
+ "https://unpkg.com": /^\/(?:@[^/]+\/)?[^/@]+@(\d+\.\d+\.\d+)(?:\/|$)/,
5
+ "https://cdnjs.cloudflare.com": /^\/ajax\/libs\/[^/]+\/(\d+\.\d+\.\d+)(?:\/|$)/
6
+ };
7
+ function originSet(values, bare = false) {
8
+ const result = /* @__PURE__ */ new Set();
9
+ for (const value of values ?? []) try {
10
+ const url = new URL(value);
11
+ if (url.protocol === "https:" && (!bare || url.pathname === "/" && !url.search && !url.hash)) result.add(url.origin.toLowerCase());
12
+ } catch {}
13
+ return result;
14
+ }
15
+ const dependencyOriginSet = (values) => originSet(values, true);
16
+ function dependencyDecision(value, approved) {
17
+ let url;
18
+ try {
19
+ url = new URL(value);
20
+ } catch {
21
+ return {
22
+ allowed: false,
23
+ reason: `${JSON.stringify(value)} is not an absolute https URL; an absolute URL at an approved origin clears this refusal`
24
+ };
25
+ }
26
+ const origin = url.origin.toLowerCase();
27
+ if (url.protocol !== "https:" || !approved.has(origin)) return {
28
+ allowed: false,
29
+ reason: `${url.href} is not at an approved dependency origin; add ${origin} to dependencyOrigins to clear this refusal`
30
+ };
31
+ const shape = PACKAGE_PATHS[origin];
32
+ if (shape && !shape.test(url.pathname)) return {
33
+ allowed: false,
34
+ reason: `${url.href} does not name an exact x.y.z package version; use an exact version to clear this refusal`
35
+ };
36
+ return {
37
+ allowed: true,
38
+ origin
39
+ };
40
+ }
41
+ //#endregion
42
+ export { dependencyDecision, dependencyOriginSet, originSet };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { BOOK_PARENT_NAMES, FlowingParentNames, PRINTED_PAGE_LIMIT, PRINTED_PAGE_ROLES, ParentPage, ParentPageMargin, PrintedPageRole, PrintedPageRules, PrintedPages, ResolvedParentPage, TextArea, bookParentPages, flowingParentNames, pagePrintedPagesIssues, parentListIssues, printedPagesIssues, resolveParentPages, textArea } from "./printed-pages.js";
2
+ import { BookChapterEntry, BookContents, BookDivision, BookDivisions, BookFrontMatterEntry, BookItem, BookOpens, BookSection, BookSectionEntry, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, MAX_PART_DEPTH, Part, REGION_NAME, TemplatedPage, TemplatedSection, bookSections, isBookContents, isChapter, isDesignedSection, isPart, isTemplatedSection } from "./book-section.js";
1
3
  import { Board, BoardInput, BoardItem, BoardLabel, BoardSection, GridCell } from "./board.js";
2
4
  import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckInput, DeckLimits, ImageFit, Manifest, Narration, PLAYBACK_MODES, Playback, PlaybackMode, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits, parsePlayback } from "./deck.js";
3
5
  import { BoardItemAnchor, MIN_BOARD_ITEM_WIDTH, addItem, moveItems, moveSection, removeItems, resizeItem } from "./board-edit.js";
@@ -6,25 +8,27 @@ import { BoardListingGroup, boardListing, boardListingIsEmpty, foldForSearch, na
6
8
  import { GridDropTarget, deriveSectionCells, gridDropMarkerBox, gridDropTarget, insertIntoGrid, layoutSection, removeFromGrid } from "./board-section-grid.js";
7
9
  import { MAKE_ROOM_LIMIT, SECTION_GAP, SECTION_MIN_SIZE, SECTION_PADDING, SECTION_TITLE_ROOM } from "./board-section-constants.js";
8
10
  import { assignMembership, fitSection, fitTouchedSections, makeRoom, settleBoard } from "./board-sections.js";
9
- import { BOOK_PARENT_NAMES, PRINTED_PAGE_LIMIT, PRINTED_PAGE_ROLES, ParentPage, ParentPageMargin, PrintedPageRole, PrintedPageRules, PrintedPages, ResolvedParentPage, bookParentPages, pagePrintedPagesIssues, parentListIssues, printedPagesIssues, resolveParentPages } from "./printed-pages.js";
10
- import { BookChapterEntry, BookContents, BookFrontMatterEntry, BookOpens, BookSection, BookSectionParents, BookTemplate, Chapter, DesignedPage, DesignedSection, REGION_NAME, TemplatedPage, TemplatedSection, isBookContents, isChapter, isDesignedSection, isTemplatedSection } from "./book-section.js";
11
- import { Book, BookInput, BookMode, BookPage, BookRunningHead, BookRunningHeadSource, BookView, BookViewInput, BookViewPagination, noteMarkerIssues, resolveBookPagination } from "./book.js";
11
+ import { NoteMarker, NumberSystem, defaultPageNumbering, formatNumber, isHebrew, noteMarker } from "./numbering.js";
12
+ import { NoteNumbering, NotePlacement, NoteSeries, NoteSeriesInput, ResolvedNoteSeries, noteMarkerIssues, resolveNoteSeries } from "./note-series.js";
13
+ import { Book, BookInput, BookMode, BookPage, BookRunningHead, BookRunningHeadSource, BookView, BookViewInput, BookViewPagination, resolveBookPagination } from "./book.js";
14
+ import "./book-exports.js";
12
15
  import { DeckFromSlidesOptions, SlideRow, deckFromSlides } from "./deck-from-slides.js";
13
16
  import { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection, textDirection } from "./direction.js";
14
17
  import { PAPER_FIT_TOLERANCE_MM } from "./imposition-fit.js";
15
- import { CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, FOLD_DASH_OFF_MM, FOLD_DASH_ON_MM, MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, MarkSegment, NAMED_PAPERS, NamedPaper, NamedPaperMetadata, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PX_PER_MM, Paper, PaperBox, PaperGroup, PaperUnit, PrintSetting, PrintSettingInput, fromMillimeters, paperPixels, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
18
+ import { CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, FOLD_DASH_OFF_MM, FOLD_DASH_ON_MM, MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, MarkSegment, NAMED_PAPERS, NamedPaper, NamedPaperMetadata, ORIENTATIONS, Orientation, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PX_PER_MM, PX_PER_PT, Paper, PaperBox, PaperGroup, PaperUnit, PrintSetting, PrintSettingInput, fromMillimeters, paperPixels, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
16
19
  import { FOLD_KINDS, FOLD_TUCK_IN_MM, FoldKind, foldCellPages, foldColumns, foldPageCountMessage, foldPanelMap } from "./fold.js";
17
20
  import { APP_FONT_NAME, APP_FONT_NAME_MESSAGE, AppFont, FONT_FORMATS, FONT_GENERICS, FontFace, FontFormat, FontGeneric, FontReference, FontReferenceInput, FontSource, LocalFaceTransport, LocalFacesInput, LocalFacesTransport, localFontReferences } from "./fonts.js";
18
21
  import { Imposed, MillimeterEdges, PageFit, PagePlacementKind, PagePlacementLayout, Placement, fitPage, impose, mirrorPlacement, pagePlacementLayout } from "./imposition.js";
19
22
  import { ImpositionMarkEdge, ImpositionSideMarks, MIN_MARK_LENGTH_MM, OmittedImpositionMark, impositionMarks } from "./imposition-marks.js";
20
23
  import { Lexicon, PronunciationEntry, lexiconVersion } from "./lexicon.js";
24
+ import { LOCAL_FONT_LIMITS, LocalFontLimitFace, LocalFontLimits, localFontLimitRefusal } from "./local-font-limits.js";
21
25
  import { BOOK_FURNITURE, BookFurniture, LIBRARY_MOTIF_PREFIX, MOTIF_ATTRIBUTE, Motif, MotifField, MotifFieldInput, MotifInput, MotifPlacement, MotifSource, MotifVersion, MotifVersionChoice, MotifVersionInput, PRINTED_PAGE_CONTEXT, PRINTED_PAGE_FOLIO_PATH, PRINTED_PAGE_NUMBER_PATH, PRINTED_PAGE_RUNNING_HEAD_PATH, PRINTED_PAGE_TOTAL_PATH, chooseMotifVersion, motifFieldAttribute } from "./motif.js";
22
- import { NoteMarker, NumberSystem, defaultPageNumbering, formatNumber, isHebrew, noteMarker } from "./numbering.js";
23
26
  import { isPrintedPageIdentityImposition } from "./printed-page-imposition.js";
24
27
  import { Scripts } from "./scripts.js";
25
28
  import { ShotUse, shotsUsed } from "./shots-used.js";
26
29
  import { MAX_SLIDE_TIMING_MS } from "./timing.js";
27
30
  import { DEFAULT_TRANSITION_DURATION_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, Transition, TransitionInput } from "./transition.js";
31
+ import { DependencyDecision, dependencyDecision, dependencyOriginSet, originSet } from "./dependency-policy.js";
28
32
  import { Fill, FillValues, SLOT_TYPES, SlotDeclaration, SlotDeclarationInput, SlotKey, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, mergeSlotDeclarations } from "./slots.js";
29
33
  import { z } from "zod";
30
34
  //#region src/index.d.ts
@@ -452,6 +456,8 @@ export type PageInput = z.input<typeof Page>;
452
456
  export declare function jsonSchemas(): {
453
457
  book: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
454
458
  title: z.ZodString;
459
+ authors: z.ZodOptional<z.ZodArray<z.ZodString>>;
460
+ subject: z.ZodOptional<z.ZodString>;
455
461
  mode: z.ZodEnum<{
456
462
  continuous: "continuous";
457
463
  paginated: "paginated";
@@ -516,80 +522,10 @@ export declare function jsonSchemas(): {
516
522
  auto: "auto";
517
523
  }>>;
518
524
  lang: z.ZodOptional<z.ZodString>;
519
- frontMatter: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
520
- pages: z.ZodArray<z.ZodObject<{
521
- html: z.ZodString;
522
- }, z.core.$strip>>;
523
- title: z.ZodOptional<z.ZodString>;
524
- contents: z.ZodDefault<z.ZodBoolean>;
525
- opens: z.ZodOptional<z.ZodEnum<{
526
- any: "any";
527
- recto: "recto";
528
- verso: "verso";
529
- }>>;
530
- parents: z.ZodOptional<z.ZodObject<{
531
- opener: z.ZodOptional<z.ZodString>;
532
- recto: z.ZodOptional<z.ZodString>;
533
- verso: z.ZodOptional<z.ZodString>;
534
- blank: z.ZodOptional<z.ZodString>;
535
- fixed: z.ZodOptional<z.ZodString>;
536
- }, z.core.$strip>>;
537
- kind: z.ZodLiteral<"designed">;
538
- }, z.core.$strip>, z.ZodObject<{
539
- template: z.ZodString;
540
- pages: z.ZodArray<z.ZodObject<{
541
- template: z.ZodOptional<z.ZodString>;
542
- regions: z.ZodRecord<z.ZodString, z.ZodString>;
543
- }, z.core.$strip>>;
544
- title: z.ZodOptional<z.ZodString>;
545
- contents: z.ZodDefault<z.ZodBoolean>;
546
- opens: z.ZodOptional<z.ZodEnum<{
547
- any: "any";
548
- recto: "recto";
549
- verso: "verso";
550
- }>>;
551
- parents: z.ZodOptional<z.ZodObject<{
552
- opener: z.ZodOptional<z.ZodString>;
553
- recto: z.ZodOptional<z.ZodString>;
554
- verso: z.ZodOptional<z.ZodString>;
555
- blank: z.ZodOptional<z.ZodString>;
556
- fixed: z.ZodOptional<z.ZodString>;
557
- }, z.core.$strip>>;
558
- kind: z.ZodLiteral<"templated">;
559
- }, z.core.$strip>, z.ZodObject<{
560
- kind: z.ZodLiteral<"contents">;
561
- title: z.ZodOptional<z.ZodString>;
562
- opens: z.ZodOptional<z.ZodEnum<{
563
- any: "any";
564
- recto: "recto";
565
- verso: "verso";
566
- }>>;
567
- parents: z.ZodOptional<z.ZodObject<{
568
- opener: z.ZodOptional<z.ZodString>;
569
- recto: z.ZodOptional<z.ZodString>;
570
- verso: z.ZodOptional<z.ZodString>;
571
- blank: z.ZodOptional<z.ZodString>;
572
- fixed: z.ZodOptional<z.ZodString>;
573
- }, z.core.$strip>>;
574
- }, z.core.$strip>, z.ZodObject<{
575
- title: z.ZodOptional<z.ZodString>;
576
- contents: z.ZodDefault<z.ZodBoolean>;
577
- opens: z.ZodOptional<z.ZodEnum<{
578
- any: "any";
579
- recto: "recto";
580
- verso: "verso";
581
- }>>;
582
- parents: z.ZodOptional<z.ZodObject<{
583
- opener: z.ZodOptional<z.ZodString>;
584
- recto: z.ZodOptional<z.ZodString>;
585
- verso: z.ZodOptional<z.ZodString>;
586
- blank: z.ZodOptional<z.ZodString>;
587
- fixed: z.ZodOptional<z.ZodString>;
588
- }, z.core.$strip>>;
589
- html: z.ZodString;
590
- kind: z.ZodOptional<z.ZodLiteral<"front">>;
591
- }, z.core.$strip>], "kind">>>;
592
- chapters: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
525
+ frontMatter: z.ZodDefault<z.ZodArray<z.ZodType<BookItem, unknown, z.core.$ZodTypeInternals<BookItem, unknown>>>>;
526
+ body: z.ZodOptional<z.ZodArray<z.ZodType<BookItem, unknown, z.core.$ZodTypeInternals<BookItem, unknown>>>>;
527
+ endMatter: z.ZodDefault<z.ZodArray<z.ZodType<BookItem, unknown, z.core.$ZodTypeInternals<BookItem, unknown>>>>;
528
+ chapters: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
593
529
  pages: z.ZodArray<z.ZodObject<{
594
530
  html: z.ZodString;
595
531
  }, z.core.$strip>>;
@@ -646,7 +582,7 @@ export declare function jsonSchemas(): {
646
582
  fixed: z.ZodOptional<z.ZodString>;
647
583
  }, z.core.$strip>>;
648
584
  kind: z.ZodOptional<z.ZodLiteral<"chapter">>;
649
- }, z.core.$strip>], "kind">>;
585
+ }, z.core.$strip>], "kind">>>;
650
586
  parentPages: z.ZodDefault<z.ZodArray<z.ZodObject<{
651
587
  name: z.ZodString;
652
588
  basedOn: z.ZodOptional<z.ZodString>;
@@ -753,6 +689,27 @@ export declare function jsonSchemas(): {
753
689
  }>>;
754
690
  title: z.ZodOptional<z.ZodString>;
755
691
  }, z.core.$strip>>;
692
+ notes: z.ZodDefault<z.ZodArray<z.ZodObject<{
693
+ name: z.ZodString;
694
+ placement: z.ZodOptional<z.ZodEnum<{
695
+ page: "page";
696
+ chapter: "chapter";
697
+ book: "book";
698
+ part: "part";
699
+ }>>;
700
+ numbering: z.ZodOptional<z.ZodEnum<{
701
+ chapter: "chapter";
702
+ book: "book";
703
+ part: "part";
704
+ }>>;
705
+ marker: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
706
+ arabic: "arabic";
707
+ "roman-lower": "roman-lower";
708
+ "roman-upper": "roman-upper";
709
+ hebrew: "hebrew";
710
+ }>, z.ZodLiteral<"symbols">]>>;
711
+ title: z.ZodOptional<z.ZodString>;
712
+ }, z.core.$strip>>>;
756
713
  rectoOpenings: z.ZodDefault<z.ZodBoolean>;
757
714
  orphans: z.ZodDefault<z.ZodNumber>;
758
715
  widows: z.ZodDefault<z.ZodNumber>;
@@ -763,6 +720,8 @@ export declare function jsonSchemas(): {
763
720
  first: "first";
764
721
  last: "last";
765
722
  }>;
723
+ }, z.core.$strip>, z.ZodObject<{
724
+ part: z.ZodString;
766
725
  }, z.core.$strip>]>>;
767
726
  verso: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"title">, z.ZodObject<{
768
727
  mark: z.ZodString;
@@ -770,6 +729,8 @@ export declare function jsonSchemas(): {
770
729
  first: "first";
771
730
  last: "last";
772
731
  }>;
732
+ }, z.core.$strip>, z.ZodObject<{
733
+ part: z.ZodString;
773
734
  }, z.core.$strip>]>>;
774
735
  }, z.core.$strip>>;
775
736
  contents: z.ZodDefault<z.ZodObject<{
@@ -797,6 +758,7 @@ export declare function jsonSchemas(): {
797
758
  css: z.ZodOptional<z.ZodString>;
798
759
  title: z.ZodOptional<z.ZodString>;
799
760
  html: z.ZodString;
761
+ flow: z.ZodOptional<z.ZodString>;
800
762
  pagination: z.ZodOptional<z.ZodObject<{
801
763
  paper: z.ZodObject<{
802
764
  width: z.ZodNumber;
@@ -857,6 +819,8 @@ export declare function jsonSchemas(): {
857
819
  first: "first";
858
820
  last: "last";
859
821
  }>;
822
+ }, z.core.$strip>, z.ZodObject<{
823
+ part: z.ZodString;
860
824
  }, z.core.$strip>]>>;
861
825
  verso: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"title">, z.ZodObject<{
862
826
  mark: z.ZodString;
@@ -864,6 +828,8 @@ export declare function jsonSchemas(): {
864
828
  first: "first";
865
829
  last: "last";
866
830
  }>;
831
+ }, z.core.$strip>, z.ZodObject<{
832
+ part: z.ZodString;
867
833
  }, z.core.$strip>]>>;
868
834
  }, z.core.$strip>;
869
835
  }, z.core.$strip>>;
@@ -1812,4 +1778,4 @@ export declare function jsonSchemas(): {
1812
1778
  }, z.core.$strict>>;
1813
1779
  };
1814
1780
  //#endregion
1815
- export { APP_FONT_NAME, APP_FONT_NAME_MESSAGE, Annotation, type AppFont, type ArrangeOptions, BOOK_FURNITURE, BOOK_PARENT_NAMES, Board, type BoardInput, BoardItem, type BoardItemAnchor, BoardLabel, type BoardListingGroup, BoardSection, type BoardShapes, type BoardView, Book, BookChapterEntry, BookContents, BookFrontMatterEntry, BookFurniture, type BookInput, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, BookSectionParents, BookTemplate, BookView, type BookViewInput, BookViewPagination, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, DesignedPage, DesignedSection, Direction, FOLD_DASH_OFF_MM, FOLD_DASH_ON_MM, FOLD_KINDS, FOLD_TUCK_IN_MM, FONT_FORMATS, FONT_GENERICS, Fill, FillValues, type FoldKind, type FontFace, type FontFormat, type FontGeneric, FontReference, FontReferenceInput, type FontSource, GridCell, type GridDropTarget, ImageFit, type Imposed, type ImpositionMarkEdge, type ImpositionSideMarks, LIBRARY_MOTIF_PREFIX, Lexicon, LocalFaceTransport, type LocalFacesInput, LocalFacesTransport, 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_MARK_LENGTH_MM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, MOTIF_ATTRIBUTE, Manifest, type MarkSegment, type MillimeterEdges, Motif, MotifField, MotifFieldInput, MotifInput, MotifPlacement, MotifSource, MotifVersion, MotifVersionChoice, MotifVersionInput, NAMED_PAPERS, type NamedPaper, type NamedPaperMetadata, Narration, NoteMarker, NumberSystem, ORIENTATIONS, type OmittedImpositionMark, Orientation, PAPER_FIT_TOLERANCE_MM, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PRINTED_PAGE_CONTEXT, PRINTED_PAGE_FOLIO_PATH, PRINTED_PAGE_LIMIT, PRINTED_PAGE_NUMBER_PATH, PRINTED_PAGE_ROLES, PRINTED_PAGE_RUNNING_HEAD_PATH, PRINTED_PAGE_TOTAL_PATH, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type PaperGroup, PaperUnit, ParentPage, ParentPageMargin, type Placement, Playback, type PlaybackMode, Point, PrintSetting, PrintSettingInput, PrintedPageRole, PrintedPageRules, PrintedPages, PronunciationEntry, PublishedShot, REGION_NAME, ResolvedParentPage, 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, SlotKey, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, TemplatedPage, TemplatedSection, TextDirection, Transition, TransitionInput, Word, type ZoomBounds, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, bookParentPages, chooseMotifVersion, deckFromSlides, defaultPageNumbering, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, foldCellPages, foldColumns, foldForSearch, foldPageCountMessage, foldPanelMap, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, impositionMarks, insertIntoGrid, isBookContents, isChapter, isDesignedSection, isHebrew, isPrintedPageIdentityImposition, isTemplatedSection, itemAt, itemHeight, languageDirection, layoutSection, lexiconVersion, localFontReferences, makeRoom, mergeSlotDeclarations, mirrorPlacement, motifFieldAttribute, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, pagePrintedPagesIssues, paperPixels, parentListIssues, parsePlayback, printBoxes, printPadding, printProperties, printedPagesIssues, removeFromGrid, removeItems, resizeItem, resolveBookPagination, resolveDirection, resolveParentPages, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, textDirection, toMillimeters, visibleItems, zoomAt, zoomToFit };
1781
+ export { APP_FONT_NAME, APP_FONT_NAME_MESSAGE, Annotation, type AppFont, type ArrangeOptions, BOOK_FURNITURE, BOOK_PARENT_NAMES, Board, type BoardInput, BoardItem, type BoardItemAnchor, BoardLabel, type BoardListingGroup, BoardSection, type BoardShapes, type BoardView, Book, BookChapterEntry, BookContents, type BookDivision, type BookDivisions, BookFrontMatterEntry, BookFurniture, type BookInput, BookItem, BookMode, BookOpens, BookPage, BookRunningHead, BookRunningHeadSource, BookSection, type BookSectionEntry, BookSectionParents, BookTemplate, BookView, type BookViewInput, BookViewPagination, Box, CUSTOM_PAPER_MAX_MM, CUSTOM_PAPER_MIN_MM, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, type DependencyDecision, DesignedPage, DesignedSection, Direction, FOLD_DASH_OFF_MM, FOLD_DASH_ON_MM, FOLD_KINDS, FOLD_TUCK_IN_MM, FONT_FORMATS, FONT_GENERICS, Fill, FillValues, FlowingParentNames, type FoldKind, type FontFace, type FontFormat, type FontGeneric, FontReference, FontReferenceInput, type FontSource, GridCell, type GridDropTarget, ImageFit, type Imposed, type ImpositionMarkEdge, type ImpositionSideMarks, LIBRARY_MOTIF_PREFIX, LOCAL_FONT_LIMITS, Lexicon, LocalFaceTransport, type LocalFacesInput, LocalFacesTransport, type LocalFontLimitFace, type LocalFontLimits, MAKE_ROOM_LIMIT, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_PART_DEPTH, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ITEM_WIDTH, MIN_BOARD_ZOOM, MIN_MARK_LENGTH_MM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, MOTIF_ATTRIBUTE, Manifest, type MarkSegment, type MillimeterEdges, Motif, MotifField, MotifFieldInput, MotifInput, MotifPlacement, MotifSource, MotifVersion, MotifVersionChoice, MotifVersionInput, NAMED_PAPERS, type NamedPaper, type NamedPaperMetadata, Narration, NoteMarker, NoteNumbering, NotePlacement, NoteSeries, type NoteSeriesInput, NumberSystem, ORIENTATIONS, type OmittedImpositionMark, Orientation, PAPER_FIT_TOLERANCE_MM, PAPER_GROUPS, PAPER_METADATA, PAPER_MM, PAPER_UNITS, PLAYBACK_MODES, PRINTED_PAGE_CONTEXT, PRINTED_PAGE_FOLIO_PATH, PRINTED_PAGE_LIMIT, PRINTED_PAGE_NUMBER_PATH, PRINTED_PAGE_ROLES, PRINTED_PAGE_RUNNING_HEAD_PATH, PRINTED_PAGE_TOTAL_PATH, PX_PER_MM, PX_PER_PT, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type PaperGroup, PaperUnit, ParentPage, ParentPageMargin, Part, type Placement, Playback, type PlaybackMode, Point, PrintSetting, PrintSettingInput, PrintedPageRole, PrintedPageRules, PrintedPages, PronunciationEntry, PublishedShot, REGION_NAME, type ResolvedNoteSeries, ResolvedParentPage, 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, SlotKey, SlotReport, SlotSource, SlotState, SlotType, SlotValue, Slots, SlotsInput, SlotsOptions, TemplatedPage, TemplatedSection, TextArea, TextDirection, Transition, TransitionInput, Word, type ZoomBounds, addItem, annotationCueIssues, arrange, assignMembership, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, bookParentPages, bookSections, chooseMotifVersion, deckFromSlides, defaultPageNumbering, dependencyDecision, dependencyOriginSet, deriveSectionCells, exceedsLimits, firstStrongDirection, fitPage, fitSection, fitTouchedSections, flowingParentNames, foldCellPages, foldColumns, foldForSearch, foldPageCountMessage, foldPanelMap, formatNumber, fromMillimeters, gridDropMarkerBox, gridDropTarget, impose, impositionMarks, insertIntoGrid, isBookContents, isChapter, isDesignedSection, isHebrew, isPart, isPrintedPageIdentityImposition, isTemplatedSection, itemAt, itemHeight, languageDirection, layoutSection, lexiconVersion, localFontLimitRefusal, localFontReferences, makeRoom, mergeSlotDeclarations, mirrorPlacement, motifFieldAttribute, moveItems, moveSection, nameMatches, noteMarker, noteMarkerIssues, originSet, pagePlacementLayout, pagePrintedPagesIssues, paperPixels, parentListIssues, parsePlayback, printBoxes, printPadding, printProperties, printedPagesIssues, removeFromGrid, removeItems, resizeItem, resolveBookPagination, resolveDirection, resolveNoteSeries, resolveParentPages, revealView, roundMillimeters, screenToBoard, settleBoard, sheetMm, shotsUsed, textArea, textDirection, toMillimeters, visibleItems, zoomAt, zoomToFit };